cmdr
Check-in [9d0fa722e9]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

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

Overview
Comment:Bump versions of cmdr::color and cmdr::ask to 1. Fixed a prompt issue in cmdr::ask::string*. Extended debug narrative regarding prompt handling.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9d0fa722e9ba9e357f264bffa2bf626ef82647d9
User & Date: andreask 2014-08-27 23:41:25
Context
2014-08-29
05:07
Tweaked output for help --full, added option arguments for options requiring them. check-in: 84658915a6 user: aku tags: trunk
2014-08-27
23:41
Bump versions of cmdr::color and cmdr::ask to 1. Fixed a prompt issue in cmdr::ask::string*. Extended debug narrative regarding prompt handling. check-in: 9d0fa722e9 user: andreask tags: trunk
2014-08-26
20:56
Fix another oops. check-in: db22847a09 user: andreask tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ask.tcl.

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
331
332
333
334
335
336
337

338
339


340
341
342
343

344
345



346


347
348
349
350
351
352
    }
    return $response
}

proc ::cmdr::ask::string* {query} {
    debug.cmdr/ask {}

    Ensure query :   ;# TODO: allow customization (string prompt string)
    append query { }

    try {
	set response [Interact {*}[Fit $query 10] -hidden 1]
    } on error {e o} {
	if {$e eq "aborted"} {
	    error Interrupted error SIGTERM
	}
................................................................................
    # set header [join [lreverse [lassign [lreverse [split $prompt \n]] prompt]] \n]
    append prompt { }

    return [list $header $prompt]
}

proc ::cmdr::ask::Chop {var charset} {

    upvar 1 $var text
    set text [::string trimright $text $charset]


    return
}

proc ::cmdr::ask::Ensure {var char} {

    upvar 1 $var text
    if {[::string index $text end] eq $char} return



    append text $char


    return
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::ask 0






|
|







 







>


>
>




>

|
>
>
>

>
>





|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
    }
    return $response
}

proc ::cmdr::ask::string* {query} {
    debug.cmdr/ask {}

    Chop   query {: }
    append query {: }   ;# TODO: allow customization (string prompt string)

    try {
	set response [Interact {*}[Fit $query 10] -hidden 1]
    } on error {e o} {
	if {$e eq "aborted"} {
	    error Interrupted error SIGTERM
	}
................................................................................
    # set header [join [lreverse [lassign [lreverse [split $prompt \n]] prompt]] \n]
    append prompt { }

    return [list $header $prompt]
}

proc ::cmdr::ask::Chop {var charset} {
    debug.cmdr/ask {}
    upvar 1 $var text
    set text [::string trimright $text $charset]

    debug.cmdr/ask {/done ==> ($text)}
    return
}

proc ::cmdr::ask::Ensure {var char} {
    debug.cmdr/ask {}
    upvar 1 $var text
    if {[::string index $text end] eq $char} {
	debug.cmdr/ask {/done, no change}
	return
    }
    append text $char

    debug.cmdr/ask {/done ==> ($text)}
    return
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::ask 1

Changes to color.tcl.

342
343
344
345
346
347
348
349
	lappend smap $c $o
    }
    lappend smap \127 \\127
} ::cmdr::color}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::color 0






|
342
343
344
345
346
347
348
349
	lappend smap $c $o
    }
    lappend smap \127 \\127
} ::cmdr::color}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::color 1