I'm following a tutorial presentation on writing CLI apps in NodeJs with CommanderJs. The presentation includes a demo app called commander-starter (https://github.com/tsantef/commander-starter).
I need help to understand (and reproduce) the mechanism by which this demo loads command-files (/root/commands/**) in response to command input by the user.
The demo has one entry point (/root/bin/cli) which requires /root/index.js and then somehow passes program flow to /commands/index.js, which then implements some sort of commandLoader to load the relevant file/module.
I have set up a very simple repo which mimics this project in order to reproduce this 'command loader' mechanism.
In summary, the objective here:
1. Explain to me the mechanism of the command-loader as implemented in the demo app commander-starter (https://github.com/tsantef/commander-starter)
2. Help me (answering questions, etc) to reproduce this functionality in my own small demo-repo, on github: https://github.com/stormbytes/cmdr-test
You can, if you like, fork my repo and make the required code changes, then push those changes back up. Your code would have to be very clear and everything commented thoroughly. The result (from the command line) would be as follows, and generated by calling hello.js and bye.js from /root/commands, in the same way that is done in the demo.
$ app hello David
-> hello, David
$app bye David
-> bye David