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 can have a single default command (i.e. .command('$0') which can parse all that, but then I miss out on the power of yargs.
I did explore subcommands, but I can't seem to get them to handle everything past a first positional argument. Pseudo code of what I tried below:
require('yargs) .command('$0[domain]','do awesomeness',(yargs)=>{yargs.command('command','do specific stuff',()=>{},(argv)=>{// take actions }).command('other-command','do other stuff',()=>{},(argv)=>{// take other actions })},(argv)=>{// do default stuff--i.e. no additional command});
Any ideas?
Thanks!
🎩
The text was updated successfully, but these errors were encountered:
@BigBlueHat the way commands are implemented is that they resolve to single command.
As a user of command line applications, I think this tends to be the expectation too, if you were going to do something compositional like this you'd tend to use | or > to combine multiple commands.
One option you might try would be a second full instance of yargs which parses the result of the first parse?
I've loved working with yargs! However, I've just hit a snag which I can't seem to get around.
I'd like to have a command line tool that works this way:
$ script-name example.com command $ script-name example.com other-command
I can have a single default command (i.e.
.command('$0')
which can parse all that, but then I miss out on the power of yargs.I did explore subcommands, but I can't seem to get them to handle everything past a first positional argument. Pseudo code of what I tried below:
Any ideas?
Thanks!
🎩
The text was updated successfully, but these errors were encountered: