-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
When a CLI has sub-commands
. Commander does not invoke top-level command action when any of the sub-command
is not provided.
Example: demo.js
#! /usr/bin/env node
const program = require('commander');
program
.option('-l, --log-level <logLevel>', 'Set log level')
.action( function() {
console.log('Executing top-level command ');
});
program
.command('dummy-command')
.action(function () {
console.log('Executing sub command ');
});
- When I run
demo dummy-command
everything works as expected and it prints Executing sub command on the stdout. - When I run
demo
it does not print **Executing top-level command ** on the stdout.
Is there a way to get this working.
Metadata
Metadata
Assignees
Labels
No labels