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 validator in args definition #84

Open
1 task done
peterroe opened this issue Oct 11, 2023 · 1 comment · May be fixed by #87
Open
1 task done

Support validator in args definition #84

peterroe opened this issue Oct 11, 2023 · 1 comment · May be fixed by #87
Labels
enhancement New feature or request

Comments

@peterroe
Copy link
Contributor

peterroe commented Oct 11, 2023

Describe the feature

export default defineCommand({
  meta: {
    name: "Test",
    description: "A test command",
  },
  args: {
    len: {
      type: "string",
      description: "Limit len",
      validator(value) {
        return Number(value) > 24 & Number(value) < 999 ? true : "Len must more than 24 and less than 999 ";
      }
    },
  },
  run({ args }) {
  },
});

Additional information

  • Would you be willing to help implement this feature?
@pi0
Copy link
Member

pi0 commented Oct 11, 2023

Nice idea! Small neat pick i would call it validate.

Also PR more than welcome to implement this!

@pi0 pi0 added the enhancement New feature or request label Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants