Skip to content

Support validator in args definition #84

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

Open
1 task done
peterroe opened this issue Oct 11, 2023 · 2 comments · May be fixed by #87 or #190
Open
1 task done

Support validator in args definition #84

peterroe opened this issue Oct 11, 2023 · 2 comments · May be fixed by #87 or #190
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
@ysknsid25 ysknsid25 linked a pull request Mar 27, 2025 that will close this issue
@kricsleo
Copy link
Member

Perhaps align with the standard-schema? 🤔

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
3 participants