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 type number to args #138

Open
1 task done
onmax opened this issue Apr 10, 2024 · 3 comments
Open
1 task done

Support type number to args #138

onmax opened this issue Apr 10, 2024 · 3 comments

Comments

@onmax
Copy link

onmax commented Apr 10, 2024

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

No tasks being tracked yet.
@janniks
Copy link

janniks commented May 28, 2024

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

@Barbapapazes
Copy link
Member

Barbapapazes commented Jul 5, 2024

related to #73, #23 and #71

No release since the PR has been merged.

@Barbapapazes
Copy link
Member

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants