add
and rm
subcommands should expect some number of arguments?
add
or rm
should be specified?
required: true
probably
add
or rm
.demandCommand
git remote rename <old> <new>
git remote remove <name>
Hi guys,
I have a problem no other command line parsing library I've explored (probably) supports and since the generality of yargs, maybe you have some solution for it, but I can't really tell as from many options you provide, I'm a bit lost :).
I want to get a list of possibly multiple commands with arguments in a row as defined on the command line, so that I can build from it a "functional pipeline", that will be applied to some array/iterator/stream.
Is this case somehow solvable with yargs?
Many thanks...
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:
.commandDir(path.join(process.cwd(), 'commands))
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?
yargs
supports command lines as the following: myprog -r repo -v clone -p proj -a
, i.e. having arguments (-r
, -v
) that are available for each command and are specified before it and arguments that are only valid for a specific command (-p
, -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.md
returns 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.issue
why
"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 script
--yargs
?