8000 Is there any way to extend flags list during execution? · Issue #2133 · urfave/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Is there any way to extend flags list during execution? #2133

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

Closed
slipros opened this issue May 16, 2025 · 1 comment
Closed

Is there any way to extend flags list during execution? #2133

slipros opened this issue May 16, 2025 · 1 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

Comments

@slipros
Copy link
slipros commented May 16, 2025

Hey, i am using cli/v2 is there any way to extend flags during execution after parsing 1 specific flag? Like if some flags has dependencies on other flags.

app := cli.NewApp()
app.Flags = []cli.Flag{
	&cli.StringFlag{
		Name: "name",
		Action: func(context *cli.Context, s string) error {
			// some logic here which generates dynamic flags. Is there any way to extend flags?

			return nil
		},
	},
}

if err := app.Run(os.Args); err != nil {
	panic(err)
}
@slipros slipros added kind/question someone asking a question area/v2 relates to / is being considered for v2 status/triage maintainers still need to look into this labels May 16, 2025
@slipros
Copy link
Author
slipros commented May 17, 2025

I figured out how to fulfill my need. I can parse needed flag from os.Args and then generate dynamic flags based.

@slipros slipros closed this as completed May 17, 2025
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

1 participant
0