Hyde46 / hoard

cli command organizer written in rust
https://hyde46.github.io/hoard/
MIT License
488 stars 25 forks source link

Remove `config_home_path` from config file and `HoardeConfig` #348

Open seivan opened 4 months ago

seivan commented 4 months ago

A config file shouldn't have a path to itself. It defeats the purpose. If you don't have a config file, the env or default config path should be used for defining it. If you do have a config file, then changing the value in the config would be undefined behaviour because the new config file might have a different config_home_path.

Most software that have a path to the config doesn't have it in the file itself, they it compute it, based on env or other stuff, like default.

There's a lot of paths in the code base were a config file is written and it gets an argument for the path, sometimes direct path and sometimes a base path. This depends on https://github.com/Hyde46/hoard/pull/347 where there is a get_hoard_config_path() function that will compute the path (but not create it).

Fix: https://github.com/Hyde46/hoard/pull/349 Depends on: https://github.com/Hyde46/hoard/pull/347