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

Regex syntax for command names #196

Open
giocodes opened this issue Nov 19, 2016 · 0 comments
Open

Regex syntax for command names #196

giocodes opened this issue Nov 19, 2016 · 0 comments

Comments

@giocodes
Copy link

Is it possible to use regex syntax to define the name of a command, for example:
vorpal .command(/\d/) // accepts any digit ...

The use case for this is to have dynamic commands that could include extra logic depending on the combination of words or digits.

A workaround could be, once the program is running through vorpal.show(); allow input without command and run them through a default action, instead of showing the error message.

Example:

vorpal .command([digits]) // accepts any digit instead of error message .action((args,callback) => { 'regex processing or any other use' ... })

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant