cmdr
Check-in [f4a5130c2e]
Not logged in

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

Overview
Comment:Tweaked the auto-help command. Default to full format only when asking for a specific command, otherwise default to a simple list.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f4a5130c2e4f31719e7a9530f0dc8faea6314201
User & Date: andreask 2013-10-15 23:46:11.053
Context
2013-10-16
17:06
Fixed bug in lappend for common blocks. Was not appending, but overwriting with last :( check-in: e8833211e0 user: andreask tags: trunk
2013-10-15
23:46
Tweaked the auto-help command. Default to full format only when asking for a specific command, otherwise default to a simple list. check-in: f4a5130c2e user: andreask tags: trunk
2013-09-23
20:11
Added missing normalization of boolean values by its validation type. check-in: fa1b9689aa user: andreask tags: trunk
Changes
Unified Diff Show Whitespace Changes Patch
Changes to help.tcl.
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138









139
140
141
142
143
144
145
	    Without arguments help for all commands is given.
	    The default format is --full.
	}
	@options@
	state format {
	    Format of the help to generate.
	    This field is fed by the options @formats@.
	} { default full }
	input cmdname {
	    The entire command line, the name of the
	    command to get help for. This can be several
	    words.
	} { optional ; list }
    } {::cmdr::help::auto-help @actor@}}]
    return
}

proc ::cmdr::help::auto-help {actor config} {
    debug.cmdr/help {}

    set width  [$config @width]
    set words  [$config @cmdname]
    set format [$config @format]










    puts [format $format $width [DictSort [query $actor $words]]]
    return
}

proc ::cmdr::help::DictSort {dict} {
    set r {}







|















>
>
>
>
>
>
>
>
>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
	    Without arguments help for all commands is given.
	    The default format is --full.
	}
	@options@
	state format {
	    Format of the help to generate.
	    This field is fed by the options @formats@.
	} { default {} }
	input cmdname {
	    The entire command line, the name of the
	    command to get help for. This can be several
	    words.
	} { optional ; list }
    } {::cmdr::help::auto-help @actor@}}]
    return
}

proc ::cmdr::help::auto-help {actor config} {
    debug.cmdr/help {}

    set width  [$config @width]
    set words  [$config @cmdname]
    set format [$config @format]

    if {$format eq {}} {
	# Default depends on the presence of additional arguments, i.e. if a specific command is asked for, or not.
	if {[llength $words]} {
	    set format full
	} else {
	    set format list
	}
    }

    puts [format $format $width [DictSort [query $actor $words]]]
    return
}

proc ::cmdr::help::DictSort {dict} {
    set r {}