Yargs is a node.js package that helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. Use this tag for questions relating to the Yargs node.js library.
Questions tagged [yargs]
143 questions
0
votes
1 answer
yargs not reading inputs correctly
in my apps.js file, I have the following code:
const yargs=require('yargs');
const argv=yargs.argv;
console.log('yargs',argv);
And when I run the command normally I get:
> node app.js read --title="to by"
yargs { _: [ 'read' ],
help: false,
…

Rik
- 1,870
- 3
- 22
- 35
0
votes
0 answers
passing arguments to different CLI app from node.js script
I'm creating a node.js CLI to automate my tasks , one of the tasks is git and the init, add,commit, remote are working just fine now the problem within the push .
Note I use shellJS to execute the commands .
the code I tried is :
shell.exec('git…

Saber Hosney
- 112
- 1
- 12
0
votes
2 answers
How to print command line arguments out with npm or yargs in a react component?
I'm trying to print out the command line arguments in a React Component.
NPM docs say I can using..
console.log(process.argv);
However, this doesn't print anything.
Array(0)
Above is what it prints in console. I'm calling my program with…

user3622460
- 1,231
- 5
- 23
- 42
0
votes
1 answer
require yargs package - NodeJS
What is the differences of var argv = require("yargs") and var argv = require("yargs").argv?
Into variable argv how the same time that i require a package, there are all functions/modules of package but .argv what is it?
Thanks all
Morris

Morris
- 601
- 1
- 8
- 22
0
votes
1 answer
node.js(yargs) numbers are entering as strings?
When I run solve-3 with --l=4 and --w=4, function rectangle.perimeter and rectangle.area output NaN. Why?
To me it seemed like the integers entered are being converted to strings hence why I added Number(), but that did not change anything.
File 1:…

Luke Midock
- 3
- 1
0
votes
1 answer
gradle not passing args to gulp with extended use options
Using the following Gradle gulp plugin which simply executes the gulp task from a gradle task via a simple naming convention gulp_
In the extended options on the docs : Gradle gulp plugin extended docs it demonstrates the…

RRR
- 35
- 7
0
votes
1 answer
yargs .command error: second argument to option must be an object
Suppose I have a file "test.js":
var args = require('yargs')
.command('command', 'command usage here', {alias: "c"} )
.argv;
Then I run:
>node test command
I got this error:
second argument to option must be an object
If I remove…

derek
- 9,358
- 11
- 53
- 94
-1
votes
1 answer
Why do I keep getting an error saying I have unexpected end of JSON input while using nodeJS and yargs
Firstly, I am a noob to node.js and JavaScript.
I am trying to write a program that stores the notes of a user in the local system using yargs.
My train of through in the handler is as follows-
First create the an object that contains the note's…

CorporalCupcake
- 3
- 2