Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between - and -- (single and double dash) in npm commands

Am wondering if this question is already addressed or not.

I have used few commands like this :

npm install -g

npm install -d

Then i have used few like :

npm install XYZ --save-dev

npm install --only=dev

Whats the fundamental difference between - and -- ?

Has it got to do anything with primary and secondary arguments ?

like image 234
BeingSuman Avatar asked Jun 01 '17 15:06

BeingSuman


2 Answers

See https://serverfault.com/questions/387935/whats-the-difference-betwen-the-single-dash-and-double-dash-flags-on-shell-comm

Basically, a single dash means that the following flags are single-character only, and generally means that more than one flag can be passed. See all other command line tools:

ls -la
grep -inr "asd" .

etc

The double dash connotes a single positional flag/argument to a command line tool.

like image 188
a p Avatar answered Sep 18 '22 06:09

a p


Generally, - is an abbreviation, there must be a corresponding -— full name.

For example:

npm install -D is equal to npm install --save-dev

npm install arguments examples

like image 43
Robin He Avatar answered Sep 17 '22 06:09

Robin He