citty
citty copied to clipboard
Support multiple optional positional args
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?
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
- [X] Would you be willing to help implement this feature?
yep, variadic positional arguments would be helpful,
maybe args._ just works?