Skip to content

Support type number to args聽#138

Open

Description

@onmax

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

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

Activity

  1. janniks commented on May 28, 2024

    @janniks

    This seems to be working (tested on latest main playground example)

  2. Barbapapazes commented on Jul 5, 2024

    @Barbapapazes
    Contributor

    related to #73, #23 and #71

    No release since the PR has been merged.

  3. Barbapapazes commented on Jul 5, 2024

    @Barbapapazes
    Contributor

    This seems to be working (tested on latest main playground example)

    Indeed, it works now (but not released yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions