devops-rob / target-cli

A CLI tool to manage context profiles for HashiCorp tools
Apache License 2.0
32 stars 5 forks source link

Support XDG_CONFIG_HOME on linux for config files #22

Open googol opened 10 months ago

googol commented 10 months ago

Hi, thanks for the great tool!

On linux there's a shift towards storing config files in the $XDG_CONFIG_HOME directory, normally configured as $HOME/.config, to keep the home directory less cluttered. It would be great if target-cli could store it's configs in $XDG_CONFIG_HOME/target instead of $HOME/.target.

XDG base directories spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Go stdlib supports this out of the box: https://pkg.go.dev/os#UserConfigDir

devops-rob commented 10 months ago

Thanks for opening this feature request. I'll be glad to take a look at this. I'm thinking of a way to make this happen without breaking the Mac support. Currently $HOME works for both Mac and Linux. Let me look at this a bit more and see what solutions I can come up with. Also feel free to suggest an approach or open a PR. Thanks again for this @googol