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 map value source #2009

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

dearchap
Copy link
Contributor

What type of PR is this?

(REQUIRED)

  • documentation
  • feature

What this PR does / why we need it:

(REQUIRED)

In order to make the cli-altsrc more modular in terms on its provider it seems to be better if map value source can be incorporated directly into cli.

Which issue(s) this PR fixes:

(REQUIRED)

Special notes for your reviewer:

(fill-in or delete this section)

Testing

(fill-in or delete this section)

go test -run=TestMapValueSource

Release Notes

(REQUIRED)

New value source for maps has been included. This allows plugin providers for other formats(json, yaml, etc) to utilize base functionality instead of each source do custom nested lookups

@abitrolly
Copy link
Contributor

abitrolly commented Nov 21, 2024

Is it the "map value" or the map of value sources?

For debugging and bug reports it might be useful to have a structure and output that shows where option is sets, and which value is selected finally. Like:

$ CLI_PATH=/eee cli --path=/ccc --debug
urfave/cli: --path (default: none, env: /eee, cmdline: /ccc, final: /ccc)

@dearchap
Copy link
Contributor Author

Is it the "map value" or the map of value sources?

For debugging and bug reports it might be useful to have a structure and output that shows where option is sets, and which value is selected finally. Like:

$ CLI_PATH=/eee cli --path=/ccc --debug
urfave/cli: --path (default: none, env: /eee, cmdline: /ccc, final: /ccc)

It is a map-value source i.e a source which can lookup values based on key.

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.

3 participants