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

Create shared args for all subCommands in main #154

Open
1 task done
fu050409 opened this issue Jul 5, 2024 · 2 comments · May be fixed by #157
Open
1 task done

Create shared args for all subCommands in main #154

fu050409 opened this issue Jul 5, 2024 · 2 comments · May be fixed by #157
Labels
enhancement New feature or request

Comments

@fu050409
Copy link

fu050409 commented Jul 5, 2024

Describe the feature

Hi!

Sometimes we need to create global args because all subcommands will use them. It's complex and duplicate if we define them in all of our subCommands' defination.

Can we provide an api to create shared args?

Additional information

  • Would you be willing to help implement this feature?
@fu050409 fu050409 added the enhancement New feature or request label Jul 5, 2024
fu050409 added a commit to fu050409/citty that referenced this issue Jul 5, 2024
@fu050409 fu050409 linked a pull request Jul 5, 2024 that will close this issue
@zuixinwang
Copy link
Contributor

image
maybe you can call the generateArgs function to do this outside citty

@HigherOrderLogic
Copy link

There's a workaround for this.

const sharedArgs = { argName: { type: 'string', ... } }

export default defineCommand({ args: { ...sharedArgs, otherArg: { ... } } })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants