Hey :)
I was confused by how ocm-cli selects its config files (and documents other behavior) and dug around a little :
How ocm-cli selects a config file path
Because config.Location() initially defaults to ~/.ocm.json but then stats the file to see if it exists and when it does not, the location is then actually defaulted to ~/.config/ocm/ocm.json (or wherever the user config folder on your system lives).
The config location is selected in this order:
- checking
$OCM_CONFIG. If not empty it will be the config location.
- checking
~/.ocm.json. If a file exists there it will the the config location.
- falling back to
$XDG_CONFIG_HOME/ocm/ocm.json (XDG_CONFIG_HOME is ~/.config by default)
I think the description for ocm config should be updated to properly reflect this behavior.
ocm config --help currently states
The location of the configuration file is gleaned from the 'OCM_CONFIG' environment variable,
or ~/.ocm.json if that variable is unset. Currently using: /home/erdii/.config/ocm/ocm.json
Which is not the complete truth.
Hey :)
I was confused by how ocm-cli selects its config files (and documents other behavior) and dug around a little :
How ocm-cli selects a config file path
Because
config.Location()initially defaults to~/.ocm.jsonbut then stats the file to see if it exists and when it does not, the location is then actually defaulted to~/.config/ocm/ocm.json(or wherever the user config folder on your system lives).The config location is selected in this order:
$OCM_CONFIG. If not empty it will be the config location.~/.ocm.json. If a file exists there it will the the config location.$XDG_CONFIG_HOME/ocm/ocm.json(XDG_CONFIG_HOMEis~/.configby default)I think the description for
ocm configshould be updated to properly reflect this behavior.ocm config --helpcurrently statesWhich is not the complete truth.