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

Change the processing order for flags #2058

Open
r0075h3ll opened this issue Feb 13, 2025 · 2 comments
Open

Change the processing order for flags #2058

r0075h3ll opened this issue Feb 13, 2025 · 2 comments
Labels
area/v2 relates to / is being considered for v2 kind/question someone asking a question status/triage maintainers still need to look into this

Comments

@r0075h3ll
Copy link

Hi There,

Version of cli in use: v2.27.5

The program has some flags defined, and the requirement is to change the way --flag's value is parsed i.e. to make the value available regardless of the order in which flag is defined.

Here's an example for ref

#current
./program --flag value args --some-command

#to-do
./program args --some-command --flag value
or
./program args --flag value --some-command

Is there any way we can do that?

Thanks!

@r0075h3ll r0075h3ll added area/v2 relates to / is being considered for v2 kind/question someone asking a question status/triage maintainers still need to look into this labels Feb 13, 2025
@Skeeve
Copy link
Contributor

Skeeve commented Feb 13, 2025

You could reorder os.Args before calling cli.Run.

@dearchap
Copy link
Contributor

@r0075h3ll You should look at v3. It does this by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v2 relates to / is being considered for v2 kind/question someone asking a question status/triage maintainers still need to look into this
Projects
None yet
Development

No branches or pull requests

3 participants