33// (See accompanying file LICENSE_1_0.txt
44// or copy at http://www.boost.org/LICENSE_1_0.txt)
55
6- //
6+ //
77// This is an example of a program that uses multiple facets of the boost
8- // program_options library. It will go through different types of config
8+ // program_options library. It will go through different types of config
99// options in a heirarchal manner:
1010// 1. Default options are set.
1111// 2. Command line options are set (they override defaults).
1616// other steps).
1717// 5. Default config file (default.cfg) is read, if present (it overrides
1818// defaults but not options from the other steps).
19- //
19+ //
2020// See the bottom of this file for full usage examples
2121//
2222
@@ -217,7 +217,7 @@ class OptionsHeirarchy
217217 std::cout << " Program Options Example " << version << std::endl;
218218 throw OptionsExitsProgram ();
219219 }
220- void ParseEnvironment ()
220+ void ParseEnvironment ()
221221 {
222222 store (po::parse_environment (common_options,
223223 // The next two lines are the crazy syntax to use EnvironmentMapper as
@@ -333,16 +333,16 @@ int main(int ac, char* av[])
333333 return 0 ;
334334}
335335
336- /*
336+ /*
337337Full Usage Examples
338338===================
339339
340- These were run on windows, so some results may show that environment, but
340+ These were run on windows, so some results may show that environment, but
341341results should be similar on POSIX platforms.
342342
343343Help
344344----
345- To see the help screen, with the available options just pass the --help (or -h)
345+ To see the help screen, with the available options just pass the --help (or -h)
346346parameter. The program will then exit.
347347
348348 > example.exe --help
@@ -367,10 +367,10 @@ Version is similar to help (--version or -v).
367367
368368Basics
369369------
370- Running without any options will get the default values (path is set from the
370+ Running without any options will get the default values (path is set from the
371371environment):
372372
373- > example.exe
373+ > example.exe
374374 First 75 chars of the system path:
375375 C:\Program Files (x86)\MSBuild\14.0\bin;C:\Perl\site\bin;C:\Perl\bin;C:\Pro
376376 Verbosity: INFO
@@ -436,8 +436,8 @@ Or you can put the option immediately after it:
436436 Network Address: 127.0.0.1
437437 Network Port: 12345
438438
439- The include path (--include-path or -I) option allows for multiple paths to be
440- specified (both on the command line and in config files) and combined into a
439+ The include path (--include-path or -I) option allows for multiple paths to be
440+ specified (both on the command line and in config files) and combined into a
441441vector for use by the program.
442442
443443 > example.exe --include-path=a/b/c --include-path d/e/f -I g/h/i -Ij/k/l
@@ -455,7 +455,7 @@ vector for use by the program.
455455 Network Address: 127.0.0.1
456456 Network Port: 12345
457457
458- There are also the option of flags that do not take parameters and just set a
458+ There are also the option of flags that do not take parameters and just set a
459459boolean value to true. In this case, running the gui also causes default values
460460for the gui to be output to the screen.
461461
@@ -491,7 +491,7 @@ one specifies the "master" file the others are additional files.
491491
492492Environment Variables
493493---------------------
494- In addition to the PATH environment variable, it also knows how to read the
494+ In addition to the PATH environment variable, it also knows how to read the
495495EXAMPLE_VERBOSE environmental variable and use that to set the verbosity
496496option/
497497
@@ -509,7 +509,7 @@ option/
509509
510510However, if the --verboseity flag is also set, it will override the env
511511variable. This illustrates an important example, the way program_options works,
512- is that a parser will not override a value that has previously been set by
512+ is that a parser will not override a value that has previously been set by
513513another parser. Thus the env parser doesn't override the command line parser.
514514(We will see this again in config files.) Default values are seperate from this
515515heirarcy, they only apply if no parser has set the value and it is being read.
@@ -527,7 +527,7 @@ heirarcy, they only apply if no parser has set the value and it is being read.
527527 Network Port: 12345
528528
529529(You can unset an environmental variable with an empty set command)
530-
530+
531531 > set EXAMPLE_VERBOSE=
532532 > example.exe
533533 First 75 chars of the system path:
@@ -544,7 +544,7 @@ heirarcy, they only apply if no parser has set the value and it is being read.
544544Config Files
545545------------
546546Config files generally follow the [INI file format]
547- (https://en.wikipedia.org/wiki/INI_file) with a few exceptions.
547+ (https://en.wikipedia.org/wiki/INI_file) with a few exceptions.
548548
549549Values can be simply added tp options with an equal sign. Here are two include
550550paths added via the default config file (default.cfg), you can have optional
@@ -661,7 +661,7 @@ Results in a combination of all three config files:
661661 Network Address: 5.6.7.8
662662 Network Port: 3000
663663
664- Incidently the boolean run-gui option could have been set a number of ways
664+ Incidently the boolean run-gui option could have been set a number of ways
665665that all result in the C++ boolean value of true:
666666
667667 run-gui=true
@@ -672,10 +672,10 @@ that all result in the C++ boolean value of true:
672672
673673Since run-gui is an option that was set with the bool_switch type, which
674674forces its use on the command line without a parameter (i.e. --run-gui instead
675- of --run-gui=true) it can't be given a "false" option, bool_switch values can
675+ of --run-gui=true) it can't be given a "false" option, bool_switch values can
676676only be turned true. If instead we had a value ("my-switch", po::value<bool>())
677- that could be set at the command line --my-switch=true or --my-switch=false, or
678- any of the other types of boolean keywords true: true, on, 1, yes;
677+ that could be set at the command line --my-switch=true or --my-switch=false, or
678+ any of the other types of boolean keywords true: true, on, 1, yes;
679679false: false, off, 0, no. In a config file this could look like:
680680
681681 my-switch=true
0 commit comments