You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...]
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: