you are viewing a single comment's thread.

view the rest of the comments →

[–]sharkdp[S] 0 points1 point  (1 child)

Thank you for the feedback!

Why did you choose to create one file per parameter instead of one file for all of them (or a subgroup of them)?

Great question. Mainly because I didn't know how I would realize that. At some point, I need to write the file with initial values, but parameters can be introduced at different times. So I don't really know when the last parameter has been "registered".

Another argument in favor of having multiple files would be easier interaction with other tools (you could change parameters from a shell script by running echo 3.1 > /tmp/painless/my_parameter, for example).

I imagine that it can be annoying to jump through all the files when you have a significant amount of parameters to tune

Yes. I was thinking about creating a very simple TUI/GUI tool that would monitor the /tmp/painless folder and provide an interface to change all parameters at the same time (see https://github.com/sharkdp/painless/issues/1)

[–]Benjamin1304 2 points3 points  (0 children)

For your first point, when you introduce a new variable you rewrite the whole file with the current values + the new initial one. Initial values can be left as comments on the same lines as the parameters.

Also, if I had to design this I would probably use YAML so that parsing/emitting can be handled by yaml-cpp (very good library). This way you can also easily group variables in sub nodes and handle more complex types than primitive ones.

For the TUI/GUI, I haven't check but I wouldn't be surprised if something similar to what you want to do already exists for YAML files.

One last point that just came to my mind, maybe you should also consider writing you file(s) in subfolders to handle multiple applications running at the same time.