cmdr
Check-in [8d7fcadf53]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modified officers. Auto-create an 'exit'-command, if not in conflict with user commands. Method as backend for private. Usable by others as well. Bumped version to 0.14.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d7fcadf537ef71c6d956aea16fcd32552aaae88
User & Date: andreask 2013-11-22 20:52:21
Context
2013-11-26
00:32
Continued documentation work, first fillings for the dev-guide, more figures. check-in: 172951e9a3 user: andreask tags: trunk
2013-11-22
20:52
Modified officers. Auto-create an 'exit'-command, if not in conflict with user commands. Method as backend for private. Usable by others as well. Bumped version to 0.14. check-in: 8d7fcadf53 user: andreask tags: trunk
2013-11-17
01:01
Added a behaviour flag "no-promote" to parameters, to allow rejection of promotion of unknown flag strings to input values on principle. Bumped version to 0.13, updated embedded documentation. check-in: b9126a7a27 user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to actor.tcl.

309
310
311
312
313
314
315
316
    ##
    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::actor 0.13






|
309
310
311
312
313
314
315
316
    ##
    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::actor 0.14

build.tcl became executable.

Changes to cmdr.tcl.

71
72
73
74
75
76
77
78
proc ::cmdr::interactive? {} {
    variable interactive
    return  $interactive
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr 0.13






|
71
72
73
74
75
76
77
78
proc ::cmdr::interactive? {} {
    variable interactive
    return  $interactive
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr 0.14

Changes to config.tcl.

1359
1360
1361
1362
1363
1364
1365
1366
    }

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::config 0.13






|
1359
1360
1361
1362
1363
1364
1365
1366
    }

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::config 0.14

Changes to doc/cmdr_officer.man.

298
299
300
301
302
303
304












305
306
307
308
309
310
311
312
[arg_def enum what]
The result code of the command, one of [const ok], or [const fail].

[arg_def any data]
The result of the command, or an error message in case of failure.
[list_end][comment {--- arguments --}]













[list_end][comment definitions]

[comment @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@]
[section {Help Information}]
[include parts/help_structure.inc]

[include parts/feedback.inc]
[manpage_end]






>
>
>
>
>
>
>
>
>
>
>
>








298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
[arg_def enum what]
The result code of the command, one of [const ok], or [const fail].

[arg_def any data]
The result of the command, or an error message in case of failure.
[list_end][comment {--- arguments --}]



[comment {- - -- --- ----- -------- -------------}]
[call [cmd <officer>] [method shell-exit] [arg config]]

This is the backend for a private ending the main shell,
be it automatically created by the pacge, or by a user.

[para] The argument is the [package cmdr::config]
instance holding the parameters. The method does not
expect any and ignore it.

[list_end][comment definitions]

[comment @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@]
[section {Help Information}]
[include parts/help_structure.inc]

[include parts/feedback.inc]
[manpage_end]

Changes to help.tcl.

506
507
508
509
510
511
512
513
    return $categories
}


# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::help 0.13






|
506
507
508
509
510
511
512
513
    return $categories
}


# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::help 0.14

Changes to officer.tcl.

155
156
157
158
159
160
161


162
163














164
165
166
167
168
169
170
...
393
394
395
396
397
398
399






400
401
402
403
404
405
406
407
408
409



410
411
412
413
414
415
416
...
614
615
616
617
618
619
620
621
	# Process the action specification only once.
	if {$myinit} return
	set myinit 1
	debug.cmdr/officer {}

	my learn $myactions



	if {[my has help]} return
	cmdr help auto [self]














	return
    }

    method learn {script} {
	debug.cmdr/officer {}
	# Make the DSL commands directly available. Note that
	# "description:" and "common" are superclass methods, and
................................................................................
    # # ## ### ##### ######## #############
    ## Shell hook methods called by the linenoise::facade.

    method prompt1   {}     { return "[my fullname] > " }
    method prompt2   {}     { error {Continuation lines are not supported} }
    method continued {line} { return 0 }
    method exit      {}     { return $myreplexit }







    method dispatch {cmd} {
	debug.cmdr/officer {}

	if {$cmd eq {}} {
	    # No command, do nothing.
	    return
	}

	if {$cmd eq ".exit"} {



	    set myreplexit 1 ; return
	}
	my Do {*}[string token shell $cmd]
    }

    method report {what data} {
	debug.cmdr/officer {}
................................................................................
	myreplexit myhandler

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::officer 0.13






>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>










>
>
>







 







|
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
...
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
...
639
640
641
642
643
644
645
646
	# Process the action specification only once.
	if {$myinit} return
	set myinit 1
	debug.cmdr/officer {}

	my learn $myactions

	# Auto-create a 'help' command when possible, i.e not in
	# conflict with a user-specified command.
	if {![my has help]} {
	    cmdr help auto [self]
	}

	# Auto-create an 'exit' command when possible, i.e not in
	# conflict with a user-specified command.
	if {![my has exit]} {
	    my learn {
		private exit {
		    description {
			Exit the shell.
			No-op if not in a shell.
		    }
		} [mymethod shell-exit]
	    }
	}
	return
    }

    method learn {script} {
	debug.cmdr/officer {}
	# Make the DSL commands directly available. Note that
	# "description:" and "common" are superclass methods, and
................................................................................
    # # ## ### ##### ######## #############
    ## Shell hook methods called by the linenoise::facade.

    method prompt1   {}     { return "[my fullname] > " }
    method prompt2   {}     { error {Continuation lines are not supported} }
    method continued {line} { return 0 }
    method exit      {}     { return $myreplexit }

    method shell-exit {config} {
	# No arguments, ignore config.
	set myreplexit 1
	return
    }

    method dispatch {cmd} {
	debug.cmdr/officer {}

	if {$cmd eq {}} {
	    # No command, do nothing.
	    return
	}

	if {$cmd eq ".exit"} {
	    # See method 'shell-exit' as well, and 'Setup' for
	    # the auto-creation of an 'exit' command when possible,
	    # i.e not in conflict with a user-specified command.
	    set myreplexit 1 ; return
	}
	my Do {*}[string token shell $cmd]
    }

    method report {what data} {
	debug.cmdr/officer {}
................................................................................
	myreplexit myhandler

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::officer 0.14

Changes to parameter.tcl.

1203
1204
1205
1206
1207
1208
1209
1210
	myisundefined mynopromote

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::parameter 0.13






|
1203
1204
1205
1206
1207
1208
1209
1210
	myisundefined mynopromote

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::parameter 0.14

Changes to private.tcl.

165
166
167
168
169
170
171
172
    variable myarguments mycmd myinit myconfig myhandler

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::private 0.13






|
165
166
167
168
169
170
171
172
    variable myarguments mycmd myinit myconfig myhandler

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::private 0.14

Changes to util.tcl.

66
67
68
69
70
71
72
73
	lappend r $k [dict get $dict $k]
    }
    return $r
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::util 0.13






|
66
67
68
69
70
71
72
73
	lappend r $k [dict get $dict $k]
    }
    return $r
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::util 0.14

Changes to validate.tcl.

317
318
319
320
321
322
323
324
325
    if {![file readable    $path]} {return 0}
    if {![file writable    $path]} {return 0}
    return 1
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::validate 0.13
return






|

317
318
319
320
321
322
323
324
325
    if {![file readable    $path]} {return 0}
    if {![file writable    $path]} {return 0}
    return 1
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::validate 0.14
return

Changes to vcommon.tcl.

105
106
107
108
109
110
111
112
113
    debug.cmdr/validate/common {= [join $candidates "\n= "]} 10
    return $candidates
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::validate::common 0.13
return






|

105
106
107
108
109
110
111
112
113
    debug.cmdr/validate/common {= [join $candidates "\n= "]} 10
    return $candidates
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::validate::common 0.14
return