Had a quick question. I am building a CLI using yargs and want to give users the options to add their own commands in a specific folder. I know I can use the following to accomplish this:
This works great when the folder exists in the project, but if it does exist I get the following error:
Error: Error: ENOENT: no such file or directory, scandir 'DIRECTORY_PATH'
is there a way add the command directory ONLY if the directory exists?
yargssupports command lines as the following:
myprog -r repo -v clone -p proj -a, i.e. having arguments (
-v) that are available for each command and are specified before it and arguments that are only valid for a specific command (
-a). Similar to https://git-scm.com/docs/git. I tried using something like
yargs.option(...).command(...)but that did not seem to work.
https://raw.githubusercontent.com/yargs/yargs/v15.4.1/docs/api.mdreturns 404 for me
yargs, that is really easy to use, supports subCommands (which is one of the thing why a lot of people use yargs), and it was intended to be testable by default.
"test mocha 'tests/**/*.test.js'"in my
package.json. As far as I understand I can pass some custom params only like this
npm run test -- --myCustomArg=foo. Can I somehow shorten it to be