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

Allow CLI configuration to be saved to a file #419

Open
amisevsk opened this issue Jul 19, 2024 · 1 comment · May be fixed by #523
Open

Allow CLI configuration to be saved to a file #419

amisevsk opened this issue Jul 19, 2024 · 1 comment · May be fixed by #523
Labels
enhancement New feature or request hacktoberfest

Comments

@amisevsk
Copy link
Contributor

Describe the problem you're trying to solve
As the CLI becomes more complex and gains more options, it would be convenient to be able to set some/all of them persistently in a configuration file. This will become increasingly useful as e.g. more networking options are added.

Describe the solution you'd like
Kit should provide a kit config command to allow configuring common options available as flags and saving that configuration between invocations. This configuration should be saved to some file (maybe in the $KITOPS_HOME directory, or separate Kit config directory) and these settings should be used instead of default values for corresponding flags.

Describe alternatives you've considered
Mainly, deferring this work until there are enough flags we're specifying on every invocation where the moderately increased complexity of supporting a config file makes sense.

Additional context
Related: #365 -- we want to be able to persistently disable update notifications, for example.

@SkySingh04
Copy link

SkySingh04 commented Oct 9, 2024

This sounds like a fun and interesting issue to work on! This will require a little bit of work but lets do this!

I had a question : are we supposed to store config for all flags for all commands or for just the root command?

@SkySingh04 SkySingh04 linked a pull request Oct 9, 2024 that will close this issue
SkySingh04 added a commit to SkySingh04/kitops that referenced this issue Oct 10, 2024
Signed-off-by: Akash Singh <[email protected]>
SkySingh04 added a commit to SkySingh04/kitops that referenced this issue Oct 17, 2024
This commit refactors the code related to loading and saving the configuration file. It introduces a new function `ConfigFilePath` in the `consts.go` file to generate the path for the configuration file based on the `configHome` directory. The `LoadConfig` function now returns the default configuration if the file doesn't exist, and the `SaveConfig` function creates the directory before saving the file. These changes improve the reliability and maintainability of the configuration handling.

Fixes jozu-ai#419
@bmicklea bmicklea linked a pull request Nov 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants