W
W
Wylaroren2021-09-25 06:04:55
Command line
Wylaroren, 2021-09-25 06:04:55

What are the names of the CLI elements in NodeJS and what combinations are possible?

I deliberately narrowed the question down to CLI NodeJS applications, because if you take native terminals, then thousands of pages of documentation will answer this question. In this question, I am also interested in the English official names, as this is important for the correct naming of variables.

What I already know about this

614e8f321a575806434468.png

1. This is basically the name of the console application being invoked (**applicationName**?)
2. I call it a command phrase (**commandPhrase**) because it doesn't have to be a single word (i.e. naming "keyword" is not appropriate.). This element is optional, as utilities like **gulp** **webpack** do without it (example command `webpack --mode production`)
3. It is essentially a string parameter (**stringParameter**), where 3.1 is the name (**parameterName**) and 3.2 is the value (**parameterValue**). There is also an alternative syntax `parameterName=parameterValue`.
4. This is a boolean parameter (**booleanParameter**), the presence of which means the value `true`. If `--foo` is followed by `--bar` and not a value, then `--foo` is boolean.

Other types of CLI elements are unknown to me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2021-09-25
@Wylaroren

The command line interface has long been a very simple standard.
There is a command (an internal shell command or an external utility like nodejs)
There are arguments to the command
Arguments are logically divided into options and parameters .
Options usually start with a dash or two (in the POSIX standard one dash for short options like -h, -e, two dashes for long options like --help, --environment)
Some options may require an option (--environment prod) , some are not.
Parameters - this is the data itself - the names of files, devices, other data in the form of text
According to the POSIX standard, short options that do not require an additional parameter can be combined under one hyphen (example: rm -rf )
Each utility has its own list of specific options and parameters. Not all utilities strictly follow POSIX, so there may be variations. To do this, read the documentation of a particular utility.
So your question is not related to nodejs, but to general standards for working on the command line.
Well, there are also redirects in the CLI, this is a separate lecture.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question