Regex syntax for command names
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 278
- PR merge metrics
- No merged PRs in 30d
Description
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!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how .command() definitions are matched after vorpal.show(), including the current error path for input without a command. Define whether regex command names and a default action are both required, then verify that digit or other pattern-based input reaches the intended .action() handler without breaking ordinary commands.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100