How do you distinguish command line switches, parameters, arguments and options.
I think they are used ambiguously a lot.
linguistic issue: command line ..
-
- Member
- Posts: 396
- Joined: Wed Nov 18, 2015 3:04 pm
- Location: San Jose San Francisco Bay Area
- Contact:
linguistic issue: command line ..
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails
Re: linguistic issue: command line ..
In a more general sense, "parameter" usually refers to the formal declaration of an input to a function while "argument" refers to the actual concrete value assigned to a parameter.
Re: linguistic issue: command line ..
Users want commands with arguments.
So, you use spaces as argument delimiters.
Users want spaces within arguments (e.g. in file names).
So, you quote arguments.
Users want quotes (and about everything you can imagine) within arguments.
So, you use yet more quotes or some other form of escaping. Perhaps, escaping should've been introduced early on...
Users want your stuff to be compatible with and have a look and feel of what they're used to.
If you haven't felt screwed yet, you are now.
You might find this useful: How Command Line Parameters Are Parsed by David Deley. Especially, if you're a fan of horror movies.
All that even before you start making sense of the command line.
So, you use spaces as argument delimiters.
Users want spaces within arguments (e.g. in file names).
So, you quote arguments.
Users want quotes (and about everything you can imagine) within arguments.
So, you use yet more quotes or some other form of escaping. Perhaps, escaping should've been introduced early on...
Users want your stuff to be compatible with and have a look and feel of what they're used to.
If you haven't felt screwed yet, you are now.
You might find this useful: How Command Line Parameters Are Parsed by David Deley. Especially, if you're a fan of horror movies.
All that even before you start making sense of the command line.
Re: linguistic issue: command line ..
alexfru, the question was linguistic, not technical.
"Switch" implies on/off settings.
"Option" implies something is optional, i.e. you can build a valid command without using any of the options.
Rusky covered parameter vs. argument already.
But yes, many people don't really consider what exactly they are writing in their documentation or tutorial. Precise use of terminology is something of a hallmark of good documentation.
"Switch" implies on/off settings.
"Option" implies something is optional, i.e. you can build a valid command without using any of the options.
Rusky covered parameter vs. argument already.
But yes, many people don't really consider what exactly they are writing in their documentation or tutorial. Precise use of terminology is something of a hallmark of good documentation.
Every good solution is obvious once you've found it.
Re: linguistic issue: command line ..
A command line consists of:
- A prompt - eg. "wajideus@wajideus-pc:~/current_directory$
- A command - eg "cp"
- Zero or more parameters
- An argument, which is typically the name of a file
- An option, which changes the behavior of a program
-
- Member
- Posts: 396
- Joined: Wed Nov 18, 2015 3:04 pm
- Location: San Jose San Francisco Bay Area
- Contact:
Re: linguistic issue: command line ..
OK just for the purpose of this discussion, let's assume all of these are same thing:)
1. command (which is part of shell or executable)
2. program
3. script
4. function
are same thing. It is easier to distinguish and not that confusing. The interest is what is after that (be it a command, program, script or function). For function, it is quite distinct because it is not what is after it rather it is usually what is withing the parenthesis.
So based on you guys' contributions:
parameter - format declaration of some sort of input.
swithes - takes on value of either on or off.
argument - actual concrete or literal value.
option - optional in that sense program/command or script can execute with or without.
1. command (which is part of shell or executable)
2. program
3. script
4. function
are same thing. It is easier to distinguish and not that confusing. The interest is what is after that (be it a command, program, script or function). For function, it is quite distinct because it is not what is after it rather it is usually what is withing the parenthesis.
So based on you guys' contributions:
parameter - format declaration of some sort of input.
swithes - takes on value of either on or off.
argument - actual concrete or literal value.
option - optional in that sense program/command or script can execute with or without.
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails