cmdr
Check-in [a2da845671]
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 tclconference@googlegroups.com
or submit via the online form by Sep 9.

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

Overview
Comment:Rename "_find" to "internal_find" instead of diddling with export.
Timelines: family | ancestors | descendants | both | trunk | release | release-1-1 | v1.1 | cmdr-1-1
Files: files | file ages | folders
SHA1:a2da845671653f1621125a74c4e0dbc707537b13
User & Date: andreask 2014-02-07 20:39:33
Context
2014-02-12
23:29
Extended the set of common validation types, added "double". Bumped cmdr::validate to 1.2 check-in: c843b9c1dd user: andreask tags: trunk
2014-02-07
20:39
Rename "_find" to "internal_find" instead of diddling with export. check-in: a2da845671 user: andreask tags: trunk, release, release-1-1, v1.1, cmdr-1-1
18:23
Oops. Have to export method "_find" for proper operation (in the recursion). check-in: 98315e9657 user: andreask tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to officer.tcl.

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165

    method find {words} {
	# Resolve chain of words (command name path) to the actor
	# responsible for that command, starting from the current
	# actor.  This is very much a convenience method built on top
	# of lookup (see above).

	my _find $words {}
    }

    export _find
    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] \
	    [linsert $prefix end $word]
    }

    method has {name} {
	debug.cmdr/officer {}
	my Setup







|


<
|









|







137
138
139
140
141
142
143
144
145
146

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

    method find {words} {
	# Resolve chain of words (command name path) to the actor
	# responsible for that command, starting from the current
	# actor.  This is very much a convenience method built on top
	# of lookup (see above).

	my internal_find $words {}
    }


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

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

	[my lookup $word] internal_find \
	    [lrange $words 1 end] \
	    [linsert $prefix end $word]
    }

    method has {name} {
	debug.cmdr/officer {}
	my Setup

Changes to private.tcl.

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
	set myhandler   {}
	return
    }

    # # ## ### ##### ######## #############

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

    export _find
    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\""
    }

    # # ## ### ##### ######## #############








|


<
|





|







67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85
86
87
88
89
90
	set myhandler   {}
	return
    }

    # # ## ### ##### ######## #############

    method find {words} {
	my internal_find $words {}
    }


    method internal_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\""
    }

    # # ## ### ##### ######## #############