|
77 |
* all the rest set the corresponding boolean variable to true. |
77 |
* all the rest set the corresponding boolean variable to true. |
78 |
* \c 0, \c f and \c false are accepted to set the variable to false. |
78 |
* \c 0, \c f and \c false are accepted to set the variable to false. |
79 |
* |
79 |
* |
|
|
80 |
* Arguments can be repeated on the command line; the last value given |
81 |
* will be the final value used. For example, |
82 |
* \verbatim |
83 |
--arg=one --toggle=f --arg=another --toggle \endverbatim |
84 |
* The variable set by \c --arg will end up with the value \c "another"; |
85 |
* the boolean set by \c --toggle will end up as \c true. |
86 |
* |
87 |
* Because arguments can be repeated it can be hard to decipher what |
88 |
* value each variable ended up with, especially when using boolean toggles. |
89 |
* Suggested best practice is for scripts to report the values of all items |
90 |
* settable throught CommandLine, as done by the example below. |
91 |
* |
92 |
* |
80 |
* CommandLine can set the initial value of every attribute in the system |
93 |
* CommandLine can set the initial value of every attribute in the system |
81 |
* with the |
94 |
* with the |
82 |
* \c --TypeIdName::AttributeName=value syntax, for example |
95 |
* \c --TypeIdName::AttributeName=value syntax, for example |
|
87 |
* to make it easy to set the \c Application::StartTime using |
100 |
* to make it easy to set the \c Application::StartTime using |
88 |
* the argument \c --start, and have its help string show as part |
101 |
* the argument \c --start, and have its help string show as part |
89 |
* of the help message. This can be done using the |
102 |
* of the help message. This can be done using the |
90 |
* <tt>AddValue(const std::string, const std::string path)</tt> method. |
103 |
* \link AddValue(const std::string, const std::string) |
|
|
104 |
* AddValue (name, attributePath) \endlink |
105 |
* method. |
91 |
* |
106 |
* |
92 |
* CommandLine can also set the value of every GlobalValue |
107 |
* CommandLine can also set the value of every GlobalValue |
93 |
* in the system with the \c --GlobalValueName=value syntax, for example |
108 |
* in the system with the \c --GlobalValueName=value syntax, for example |
94 |
* \verbatim |
109 |
* \verbatim |
95 |
--SchedulerType=HeapScheduler \endverbatim |
110 |
--SchedulerType=HeapScheduler \endverbatim |
96 |
* |
111 |
* |
97 |
* A simple example is in `src/core/example/ command-line-example.cc` |
112 |
* A simple example is in `src/core/example/``command-line-example.cc` |
98 |
* The heart of that example is this code: |
113 |
* The heart of that example is this code: |
99 |
* |
114 |
* |
100 |
* \code |
115 |
* \code |
|
114 |
* cmd.Parse (argc, argv); |
129 |
* cmd.Parse (argc, argv); |
115 |
* \endcode |
130 |
* \endcode |
116 |
* after which it prints the values of each variable. (The \c SetCbArg function |
131 |
* after which it prints the values of each variable. (The \c SetCbArg function |
117 |
* is not shown here; see `src/core/example/ command-line-example.cc`) |
132 |
* is not shown here; see `src/core/example/``command-line-example.cc`) |
118 |
* |
133 |
* |
119 |
* Here is the output from a few runs of that program: |
134 |
* Here is the output from a few runs of that program: |
120 |
* |
135 |
* |