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

Plural forms, shortened words or alternatives in the command string. #353

Open
robblovell opened this issue Mar 10, 2021 · 0 comments
Open

Comments

@robblovell
Copy link

I would like to suggest a new feature for vorpal (forgive me if i didn't see that this is implemented in the documentation or there is another issue with this suggestion). The idea is to provide a way to give fixed alternatives in command lists, kubernetes style.

Kuberentes allows implementations like so:

kubectl get apps -n aNamespace
kubectl get app -n aNamespace

Where I work, we are attempting to create commands with vorpal like:

command app services list [names...]
command app service list [names...]
command apps service list [names...]
command apps services list [names...]

command apps log
command apps logs
command app log
command app logs

Where the command requires 'app' or 'service', but also allows shorthands or plural forms like apps, service, services, svc etc.

This sort of thing can be implemented with <> brackets where the code validates what the user put after the code has entered the 'action' clause. But, we want the help to show what is possible in the command sequence. The '.alias' function could be used here too, but only in limited cases (I think).

You could do this so that the check happens before the 'action' clause in the parser with a construct like this:

.command('{app,apps} {service,services,svc,svcs} list [names...]')
.command('{app,apps} {log,logs} list [names...]')
.command('{get,grab,pull,fetch,find} {app,apps} [names...]')

Using delimiters that aren't used yet, not <> or [], which leaves {} as a good candidate.

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

1 participant