citty icon indicating copy to clipboard operation
citty copied to clipboard

Support type `number` to args

Open onmax opened this issue 10 months ago • 3 comments

Describe the feature

Description

Allow users to add a type number to the args. Citty will automatically parse the number and thrown an error if the string is invalid

Example

export default defineCommand({
  meta: {
    name: "Test",
    description: "A test command",
  },
  args: {
    len: {
      type: "number",
      description: "Limit len",
      default: 15
    },
  },
  run({ args }) {
  	args.len // Type "number"
  },
});

Related to

This issue can be related to #87

Feedback

Is this a good feature we would like to add?

Additional information

  • [X] Would you be willing to help implement this feature?
### Tasks

onmax avatar Apr 10 '24 11:04 onmax