-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
My app always requires a sub command, e.g.
node main.js sub1
or
node main.js -x sub1
It's not valid to do
node main.js
or
node main.js -x
How can I catch this scenario? Is there a way to introspect the program object to tell if a sub command was used?
I was going to use process.argv.length but that doesn't really work because a user could still pass in options without a sub-command (node main.js -x -y -z). I can get around that by parsing porcess.argv more carefully but I was hoping there was a more supported way.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels