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

Add config "get" and "path" subcommands #329

Merged
merged 1 commit into from Feb 2, 2024

Conversation

julienduchesne
Copy link
Member

@julienduchesne julienduchesne commented Feb 2, 2024

Related to #315

  • get: Allows quickly getting the current config without going into the YAML settings file
  • path: Allows actually finding the current config file. Had trouble finding the /Users/julienduchesne/Library/Application Support/grizzly/settings.yaml on my machine. This helps

While implementing the config path function, I noticed that the config logic was a bit weird. While grizzly was possibly reading (through viper) the config file from the workdir, it was writing back to the system config. Is this expected? By using viper.ConfigFileUsed(), we write back to the file we're reading the config from

- get: Allows quickly getting the current config without going into the YAML settings file
- path: Allows actually finding the current config file. Had trouble finding the `/Users/julienduchesne/Library/Application Support/grizzly/settings.yaml` on my machine. This helps

While implementing the `config path` function, I noticed that the config logic was a bit weird. While grizzly was possibly reading (through viper) the config file from the workdir, it was writing back to the system config. Is this expected? By using `viper.ConfigFileUsed()`, we write back to the file we're reading the config from
@julienduchesne julienduchesne marked this pull request as ready for review February 2, 2024 18:23
@julienduchesne julienduchesne requested a review from a team as a code owner February 2, 2024 18:23
"sort"
"strings"

"github.com/kirsle/configdir"
"github.com/spf13/viper"
"gopkg.in/yaml.v3"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use github.com/goccy/go-yaml not this one in Grizzly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, it's not in the go.mod file

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh right, that's in an unmerged branch. Ignore this comment then.

@julienduchesne julienduchesne merged commit 38caffb into main Feb 2, 2024
7 checks passed
@julienduchesne julienduchesne deleted the julienduchesne/add-config-get branch February 2, 2024 18:46
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

Successfully merging this pull request may close these issues.

None yet

2 participants