forked from SlightlyLoony/gpsctl
-
Notifications
You must be signed in to change notification settings - Fork 4
/
sl_options.txt
37 lines (30 loc) · 2.11 KB
/
sl_options.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
No argument formats:
--foo must be argument all by itself
-f can have other single character options after the first one
Required argument formats:
--foo <arg> option argument is in following command line argument
--foo=<arg> option argument is in the SAME command line argument
-f <arg> option argument is in following command line argument
-f<arg> option argument is in the SAME command line argument
-f=<arg> option argument is in the SAME command line argument
Optional argument formats:
--foo=<arg> option argument is in the SAME command line argument
-f<arg> option argument is in the SAME command line argument
-f=<arg> option argument is in the SAME command line argument
--foo <arg> NOT ALLOWED: see note below
-f <arg> NOT ALLOWED: see note below
Note on optional arguments. These are confusing, as the "natural" way for many would be to make the option argument
be a separate command line argument. This won't work for optional arguments, however, because there's no way for
slOptions to distinguish between the optional argument and some unrelated option. For example, consider the following
command line, where -foo is an option with an optional argument:
command -foo /dev /home
Is the argument "/dev" the optional argument for -foo, or is it a separate argument for command? There's no way
for slOptions to determine that, so the only safe behavior is the one described above, wherein optional arguments
MUST be part of the same command line argument. So in this case, slOptions would process -foo without the optional
argument, and would pass "/dev" as an argument to command.
Special options (all in a single command line argument):
- stop all option processing at this point; rest of options handled outside slOptions
-- stop all option processing at this point; rest of options handled outside slOptions
--? turn on slOption's debug tracing (must be the first option argument)
Program configuration:
-- a short option name of ' ' is a special case to handle the standalone '-' option