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

Support multiple optional positional args #80

Open
1 task
Rigo-m opened this issue Oct 6, 2023 · 2 comments
Open
1 task

Support multiple optional positional args #80

Rigo-m opened this issue Oct 6, 2023 · 2 comments

Comments

@Rigo-m
Copy link

Rigo-m commented Oct 6, 2023

Describe the feature

When using lint-staged, the default behaviour is to pass filenames as positional arguments to linting CLIs, e.g.: your-cmd file1.ext file2.ext

AFAIK there's no way to support positional arguments in this way in citty.
So, if I want to be able to support multiple positional arguments in my Citty CLI commands, I can't do it right now (or, at least, it's unclear if there is a way to do so).

Additional information

  • Would you be willing to help implement this feature?
@peterroe
Copy link
Contributor

Maybe this will be a decent idea, .or anybody has better advise :)

export default defineCommand({
  meta: {
    name: "lint",
    description: "A test command",
  },
  args: {
    files: {
      type: "multiple",
      description: "Files need be lint",
    },
  },
  run({ args }) {
	// lint fileA.ts fileB.ts
	console.log(args.files) //=> ['fileA.ts', 'fileB.ts]
  },
});

Additional information

  • Would you be willing to help implement this feature?

@Rettend
Copy link

Rettend commented Sep 9, 2024

yep, variadic positional arguments would be helpful,
maybe args._ just works?

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

No branches or pull requests

3 participants