| | @@ -0,0 +1,58 @@ |
| 1 | +<h1>TH1 "argv" API</h1>
|
| 2 | +
|
| 3 | +The "argv" API provides features for accessing command-line argdoesn't really
|
| 4 | +know about).
|
| 5 | +
|
| 6 | +Example usage:
|
| 7 | +
|
| 8 | +<nowiki><pre>
|
| 9 | +<th1>
|
| 10 | +set argc [argv len]
|
| 11 | +set appName [argv at 0]
|
| 12 | +# Fetch --foo|-f argument:
|
| 13 | +set foo [argv geThe various subcommands are described below...
|
| 14 | +
|
| 15 | +<h2>len</h2>
|
| 16 | +
|
| 17 | +Returns the number of arguments.
|
| 18 | +
|
| 19 | +<nowiki><pre>
|
| 20 | +set argc [argv len]
|
| 21 | +</pre></nowiki>
|
| 22 | +
|
| 23 | +
|
| 24 | +<h2>at</h2>
|
| 25 | +
|
| 26 | +Fetches the argument at the given indextrue" if the are set arg [argv at 3]
|
| 27 | +</pre></nowiki>
|
| 28 | +
|
| 29 | +
|
| 30 | +<h2>getstrment #0.
|
| 31 | +
|
| 32 | +<h2>getstr|string</h2>
|
| 33 | +
|
| 34 | +Searches for a CLI/GET/POST parameter. In CLI this function has soThis function has some non-intuitive behaviour
|
| 35 | +ernals: once a it is removed
|
| 36 | +from the internal arguments ction will never
|
| 37 | +s. CLI boolean flags
|
| 38 | +have no explicit value, and are "true" if the are set at all.
|
| 39 | +
|
| 40 | +<nowiki><pre>
|
| 41 | +set doSomething [argv bool "do-something" "D" 0]
|
| 42 | +</pre></nowiki>
|
| 43 | +
|
| 44 | +<h2>getint|int</h2>
|
| 45 | +
|
| 46 | +Works almost like <tt>getstr</tt> but searches for integer flags.
|
| 47 | +
|
| 48 | +
|
| 49 | +<nowiki><pre>
|
| 50 | +set limit [argv int "limit" "L" 10]
|
| 51 | +</pre></nowiki>
|
| 52 | +getbool "do-something" "D" 0]
|
| 53 | +</h2>
|
| 54 | +
|
| 55 | +Works almost like <tt>geinteger flags.
|
| 56 | +
|
| 57 | +
|
| 58 | +<noget |