-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
command with multiple words #655
Comments
Any advance on this? |
Parsing the command is the easy part:
The problem is in handling the user input. All arguments are pre-split, coming in as process.argv. This library would need to consider commands that have spaces and look for a match in the argv. Another way to think about this is to have nested action-based commands. But it seems that this library does not support that style. It only supports one level of nesting for action-based commands. |
We could split the name and stash it away on Command. Then, in parseArgs, we could do something like:
It's a bit of a hack, but we're looking for the first command that will match, taking as many of the arguments as it needs to make the match, then falling through to the existing behavior. |
If that seems like a reasonable approach, I'd be happy to prepare a PR. |
It would be awesome if you could submit a PR for that @mojavelinux |
Hello ! Any updates on this issue ? |
Any updates? |
Not sure if this is useful; I use const subcommand: string = process.argv[3]; // clasp apis list => "list"
const serviceName = process.argv[4]; // clasp apis enable drive => "drive" https://github.com/google/clasp/blob/master/src/commands/apis.ts#L28 Seems to work fine. |
The idea of specifying subcommands as a command with multiple words is quite interesting, and I had not thought of it. I like the simplicity, but it feels like a work-around rather than a strong model for how commands are constructed. I want to consider nested action-based commands before this. I am closing this in favour of #764 Thank you for your contributions. |
Hi, i need to define command like:
however when calling it like
prgname env save aaa bbb
gets me output of:I don't want to use the git-style approach, since process spawning and requiring all libraries for every child-process is really slowing down the program (and cli uilities should be fast, shoudn't they?)
So is there a chance to define such command?
The text was updated successfully, but these errors were encountered: