cmdr
Check-in [8117b3db5e]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.

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

Overview
Comment:Fixed issue in previous commit. New code failed to take a possible empty path into account.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8117b3db5ee19435a78584a1c3ce37991fb369c9
User & Date: andreask 2014-02-06 17:39:34
Context
2014-02-06
17:39
Bumped to version 1.1 check-in: a109f26338 user: andreask tags: trunk
17:39
Fixed issue in previous commit. New code failed to take a possible empty path into account. check-in: 8117b3db5e user: andreask tags: trunk
06:18
Remade "help::query-actor" as method "find" of officers and private. Simplified the internals of auto-help. Provides the path lookup to framework users as well. Updated the documentation. check-in: 5487358492 user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/cmdr_officer.man.

200
201
202
203
204
205
206
207
208


209
210
211
212
213
214
215

[list_end][comment arguments]

[comment {- - -- --- ----- -------- -------------}]
[call [cmd <officer>] [method find] [arg path]]

This method returns the instance command of the sub-ordinate with the
given [arg path] of names. An error is thrown if such a sub-ordinate
does not exist. See also method [method has].



[list_begin arguments]
[arg_def string path] The path of names to the sub-ordinate to look for.
[list_end]

[comment {- - -- --- ----- -------- -------------}]
[call [cmd <officer>] [method has] [arg name]]







|
|
>
>







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217

[list_end][comment arguments]

[comment {- - -- --- ----- -------- -------------}]
[call [cmd <officer>] [method find] [arg path]]

This method returns the instance command of the sub-ordinate with the
given [arg path] (a list) of names. An error is thrown if such a sub-ordinate
does not exist. This is an extension of [method lookup] to paths of names.

[para] An empty [arg path] is allowed and refers to the officer itself.

[list_begin arguments]
[arg_def string path] The path of names to the sub-ordinate to look for.
[list_end]

[comment {- - -- --- ----- -------- -------------}]
[call [cmd <officer>] [method has] [arg name]]

Changes to doc/cmdr_private.man.

121
122
123
124
125
126
127

128




129
130
131
132
133
134
135
136
[list_end][comment arguments]

[comment {- - -- --- ----- -------- -------------}]
[call [cmd <private>] [method find] [arg path]]

This method returns the instance command of the sub-ordinate with the
given [arg path] of names. An error is thrown if such a sub-ordinate

does not exist, i.e. always, as a private has no sub-ordinates,




ever. See also method [method find] of [package cdmr::officer] for the
high-end of the recursion which may end in this method.

[list_begin arguments]
[arg_def string path] The path of names to the sub-ordinate to look for.
[list_end]

[comment {- - -- --- ----- -------- -------------}]







>
|
>
>
>
>
|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
[list_end][comment arguments]

[comment {- - -- --- ----- -------- -------------}]
[call [cmd <private>] [method find] [arg path]]

This method returns the instance command of the sub-ordinate with the
given [arg path] of names. An error is thrown if such a sub-ordinate
does not exist, i.e. whenever [arg path] is not empty, as a private
has no sub-ordinates, ever.

[para] Note, as implied above, an empty [arg path] is allowed and
refers to the private itself.

[para] See also method [method find] of [package cdmr::officer] for the
high-end of the recursion which may end in this method.

[list_begin arguments]
[arg_def string path] The path of names to the sub-ordinate to look for.
[list_end]

[comment {- - -- --- ----- -------- -------------}]

Changes to officer.tcl.

141
142
143
144
145
146
147




148
149
150
151
152
153
154
	# actor.  This is very much a convenience method built on top
	# of lookup (see above).

	my _find $words {}
    }

    method _find {words prefix} {




	set word [lindex $words 0]
	if {[llength $words] <= 1} {
	    return [my lookup $word]
	}

	[my lookup $word] _find \
	    [lrange $words 1 end] \







>
>
>
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
	# actor.  This is very much a convenience method built on top
	# of lookup (see above).

	my _find $words {}
    }

    method _find {words prefix} {
	if {![llength $words]} {
	    return [self]
	}

	set word [lindex $words 0]
	if {[llength $words] <= 1} {
	    return [my lookup $word]
	}

	[my lookup $word] _find \
	    [lrange $words 1 end] \

Changes to private.tcl.

71
72
73
74
75
76
77



78
79
80
81
82
83
84
    # # ## ### ##### ######## #############

    method find {words} {
	my _find $words {}
    }

    method _find {words prefix} {



	# Privates do not have subordinates to look up.
	# We now have a bad command name argument to help.
	set word  [lindex $words 0]
	return -code error \
	    -errorcode [list CMDR ACTION BAD $word] \
	    "The command \"$prefix\" has no sub-commands, unexpected word \"$word\""
    }







>
>
>







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
    # # ## ### ##### ######## #############

    method find {words} {
	my _find $words {}
    }

    method _find {words prefix} {
	if {![llength $words]} {
	    return [self]
	}
	# Privates do not have subordinates to look up.
	# We now have a bad command name argument to help.
	set word  [lindex $words 0]
	return -code error \
	    -errorcode [list CMDR ACTION BAD $word] \
	    "The command \"$prefix\" has no sub-commands, unexpected word \"$word\""
    }