Hacker News new | ask | show | jobs
by _vufv 1336 days ago
Also, idempotency of a tool is a desired property that tool devs often invest a lot of effort in maintaining. Initializing default config on the first run is a trivial way to break it.

It's much better to just have a sane implicit default value for each setting when config is not present. Then you can list the default config in your docs or offer a CLI flag --print-default-config or --copy-default-config.

1 comments

Creating a file if it doesn't already exist is idempotent.
Only if you always create the file with the same contents, which is almost certainly not going to be true when the software evolves and adds new options.