Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | cmdr::parameter - Extended spec with description of option argument, if any. cmdr::help - Modified to make use of the new information in help texts. |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
463519edc6123af3ac608ba27ab16ac2 |
User & Date: | andreask 2014-08-29 20:19:07.573 |
References
2014-11-26
| ||
23:12 | Followup on [463519edc6]. Fixed missing handling of "arglabel" data in the json, tcl, and sql help formats. check-in: 9660d12cb0 user: andreask tags: trunk | |
Context
2014-09-10
| ||
20:21 | Moved handling of option arguments in help to separate proc. Reworked the handling of global options to show arguments as well. Fixed sorting of section display when seeing options with arguments. check-in: f41f44de14 user: andreask tags: trunk | |
2014-08-29
| ||
20:19 | cmdr::parameter - Extended spec with description of option argument, if any. cmdr::help - Modified to make use of the new information in help texts. check-in: 463519edc6 user: andreask tags: trunk | |
05:07 | Tweaked output for help --full, added option arguments for options requiring them. check-in: 84658915a6 user: aku tags: trunk | |
Changes
Changes to help.tcl.
︙ | ︙ | |||
238 239 240 241 242 243 244 | foreach {oname ohelp} [::cmdr util dictsort $options] { # Inspect the parameter and determine of the option # requires an argument. If yes, suitably extend the # definition key of the option list. set pname [dict get $opt2para $oname] set vt [dict get $parameters $pname validator] if {$vt ne "::cmdr::validate::boolean"} { | > | > | > | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | foreach {oname ohelp} [::cmdr util dictsort $options] { # Inspect the parameter and determine of the option # requires an argument. If yes, suitably extend the # definition key of the option list. set pname [dict get $opt2para $oname] set vt [dict get $parameters $pname validator] if {$vt ne "::cmdr::validate::boolean"} { if {[dict exists $parameters $pname arglabel]} { set plabel [dict get $parameters $pname arglabel] } else { set plabel [dict get $parameters $pname label] } append oname " [string toupper $plabel]" } lappend onames $oname lappend odefs $ohelp } DefList $width $onames $odefs |
︙ | ︙ |
Changes to parameter.tcl.
︙ | ︙ | |||
44 45 46 47 48 49 50 | ## Definition oo::class create ::cmdr::parameter { # # ## ### ##### ######## ############# ## Lifecycle. constructor {theconfig order cmdline required defered name desc valuespec} { | | | > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ## Definition oo::class create ::cmdr::parameter { # # ## ### ##### ######## ############# ## Lifecycle. constructor {theconfig order cmdline required defered name desc valuespec} { set myname $name ; # [R1] set mylabel $name set myarglabel $name # Import the whole collection of parameters this one is a part # of into our namespace, as the fixed command "config", for # use by the various command prefixes (generate, validate, # when-complete), all of which will be run in our namespace # context. |
︙ | ︙ | |||
152 153 154 155 156 157 158 159 160 161 162 163 164 165 | if {$myiscmdline} { return "option" } return "state" } # Identification and help. Add context name into it? method name {} { return $myname } method label {} { return $mylabel } method the-name {} { if {[my type] eq "option"} { return [my flag] } else { return $mylabel } | > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | if {$myiscmdline} { return "option" } return "state" } # Identification and help. Add context name into it? method name {} { return $myname } method label {} { return $mylabel } method arglabel {} { return $myarglabel } method the-name {} { if {[my type] eq "option"} { return [my flag] } else { return $mylabel } |
︙ | ︙ | |||
236 237 238 239 240 241 242 243 244 245 246 247 248 249 | description $mydescription \ documented $myisdocumented \ flags $myflags \ generator $mygenerate \ interactive $myinteractive \ isbool [my isbool] \ label $mylabel \ list $myislist \ ordered $myisordered \ presence $myonlypresence \ prompt $myprompt \ required $myisrequired \ threshold $mythreshold \ type [my type] \ | > | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | description $mydescription \ documented $myisdocumented \ flags $myflags \ generator $mygenerate \ interactive $myinteractive \ isbool [my isbool] \ label $mylabel \ arglabel $myarglabel \ list $myislist \ ordered $myisordered \ presence $myonlypresence \ prompt $myprompt \ required $myisrequired \ threshold $mythreshold \ type [my type] \ |
︙ | ︙ | |||
274 275 276 277 278 279 280 281 282 283 284 285 286 287 | {alias Alias} \ {default Default} \ {defered Defered} \ {generate Generate} \ {immediate Immediate} \ {interact Interact} \ {label Label} \ {list List} \ {no-promotion NoPromote} \ {optional Optional} \ {presence Presence} \ {test Test} \ {undocumented Undocumented} \ {validate Validate} \ | > | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | {alias Alias} \ {default Default} \ {defered Defered} \ {generate Generate} \ {immediate Immediate} \ {interact Interact} \ {label Label} \ {argument ArgLabel} \ {list List} \ {no-promotion NoPromote} \ {optional Optional} \ {presence Presence} \ {test Test} \ {undocumented Undocumented} \ {validate Validate} \ |
︙ | ︙ | |||
313 314 315 316 317 318 319 320 321 322 323 324 325 326 | # # ## ### ##### ######## ############# ## Internal: Parameter DSL commands. method Label {name} { set mylabel $name return } method List {} { set myislist yes return } method Presence {} { | > > > > > | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | # # ## ### ##### ######## ############# ## Internal: Parameter DSL commands. method Label {name} { set mylabel $name return } method ArgLabel {name} { set myarglabel $name return } method List {} { set myislist yes return } method Presence {} { |
︙ | ︙ | |||
1198 1199 1200 1201 1202 1203 1204 | {*}$myvalidate release [self] $value } return } # # ## ### ##### ######## ############# | | | | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 | {*}$myvalidate release [self] $value } return } # # ## ### ##### ######## ############# variable myname mylabel myarglabel mydescription \ myisordered myiscmdline myislist myisrequired \ myinteractive myprompt mydefault myhasdefault \ mywhencomplete mywhenset mygenerate myvalidate \ myflags mythreshold myhasstring mystring \ myhasvalue myvalue mylocker mystopinteraction \ myisdocumented myonlypresence myisdefered \ myisundefined mynopromote # # ## ### ##### ######## ############# } # # ## ### ##### ######## ############# ##################### ## Ready package provide cmdr::parameter 1.3 |