Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read config.yaml from XDG standard paths #30

Open
erhhung opened this issue Mar 12, 2024 · 1 comment
Open

Read config.yaml from XDG standard paths #30

erhhung opened this issue Mar 12, 2024 · 1 comment

Comments

@erhhung
Copy link

erhhung commented Mar 12, 2024

As more CLI apps are adopting the path conventions laid out by the XDG Base Directory Specification, it would be nice if config.yaml and other generated files like thread history are placed in these standard paths—or at least look for them in these paths before using ~/.chatgpt-cli/:

  • config.yaml — use $XDG_CONFIG_HOME/chatgpt-cli/config.yaml (if XDG_CONFIG_HOME is NOT explicitly defined, use ~/.config/chatgpt-cli/config.yaml)
  • history/default.json etc. — use $XDG_DATA_HOME/chatgpt-cli/history/default.json (if XDG_DATA_HOME is NOT explicitly defined, use ~/.local/share/chatgpt-cli/history/default.json)
@kardolus
Copy link
Owner

kardolus commented Mar 13, 2024

Hi @erhhung, I think this makes a lot of sense. I did not know about the XDG standard paths concept when I created the CLI.

It will take me a minute to implement this feature: I will need to create a migration script that moves your current config over to the appropriate directory. However, this migration should work from any version of the CLI (there is a migration script that runs already to account for an earlier change). So it's a little tricky :).

There are also some complications around the case in which the config or data directory does not exist. It seems like most other CLIs try to create the directory in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants