-
Notifications
You must be signed in to change notification settings - Fork 139
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
add toml config option to cmd #172
Conversation
Linter Issue ReportDuring the code review, a list issues were found. These issues could affect the code quality, maintainability, and consistency. Below is the detailed Linter issue report: common/config/config.goLint Issue: undefined: envconfig
Please make the suggested changes to improve the code quality. |
Possible Issues And Suggestions:
MR Evaluation:This feature is still under test, evaluation are given by AI and might be inaccurate. After evaluation, the code changes in the Merge Request get score: 100. TipsCodeReview Commands (invoked as MR or PR comments)
CodeReview Discussion ChatThere are 2 ways to chat with Starship CodeReview:
Note: Be mindful of the bot's finite context window. CodeReview Documentation and Community
About Us:Visit the OpenCSG StarShip website for the Dashboard and detailed information on CodeReview, CodeGen, and other StarShip modules. |
2f184ba
to
cc4efc1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The TipsCodeReview Commands (invoked as MR or PR comments)
CodeReview Discussion ChatThere are 2 ways to chat with Starship CodeReview:
Note: Be mindful of the bot's finite context window. CodeReview Documentation and Community
|
* Add toml config option to cmd * update git ignore * add config cmd --------- Co-authored-by: yiling <yiling@yilingdeMacBook-Air.local>
This PR introduces a
--config
option to allcmd
commands, enabling configuration to be read from a TOML config file. The existing environment-based configuration still working and should not be affected by this.Example Usage:
An example configuration file has been added. To set up for local development, rename it to
local.toml
, place it in the project root, and customize as needed. While other names can be used,local.toml
is added to.gitignore
to prevent accidental commits.Replace
github.com/kelseyhightower/envconfig
withgithub.com/sethvargo/go-envconfig
because onlysethvargo/go-envconfig
supports overwrite mode. Note that the syntax of the config struct tags has changed because of this update.Notes:
When both config file and environment variables are used, environment variables always take precedence, overwriting same config from the config file.
If any configurations are missing in the config file, default values are provided based on the
default
struct tag.MR Summary:
The summary is added by @codegpt.
This Merge Request introduces a
--config
option forcmd
commands, allowing configurations to be read from a TOML file, while maintaining compatibility with the existing environment variable-based configuration. It replacesgithub.com/kelseyhightower/envconfig
withgithub.com/sethvargo/go-envconfig
to support overwrite mode and changes the syntax for config struct tags. The MR ensures that environment variables take precedence over config file settings and provides default values for missing configurations. Additionally, it includes a test suite for the new configuration loading mechanism.Key updates:
cmd
commands.envconfig
package to support overwrite mode.