Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Tweaked options for "operation" command, extended a bit, plus slider & larson animation classes. |
---|---|
Timelines: | family | ancestors | descendants | both | say-more |
Files: | files | file ages | folders |
SHA1: |
e250dbed44acd0811bdf3a15d876a43b |
User & Date: | andreask 2015-05-01 00:06:56.715 |
Context
2015-05-01
| ||
22:55 | New command for output to stderr, plus two higher-level helpers for headers and banners. check-in: 64bb90174f user: andreask tags: say-more | |
00:06 | Tweaked options for "operation" command, extended a bit, plus slider & larson animation classes. check-in: e250dbed44 user: andreask tags: say-more | |
2015-04-30
| ||
22:00 | More animations, extended the "operation" command with easy integration of animations, added examples. Added helper script "local" for easier execution of the examples without having cmdr::say installed. check-in: de4974db8f user: andreask tags: say-more | |
Changes
Changes to say.tcl.
︙ | ︙ | |||
36 37 38 39 40 41 42 | namespace eval ::cmdr::say { namespace export \ up down forw back \ erase-screen erase-up erase-down \ erase-line erase-back erase-forw \ goto home line add line rewind lock-prefix clear-prefix \ next next* animate barberpole percent progress-counter progress \ | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | namespace eval ::cmdr::say { namespace export \ up down forw back \ erase-screen erase-up erase-down \ erase-line erase-back erase-forw \ goto home line add line rewind lock-prefix clear-prefix \ next next* animate barberpole percent progress-counter progress \ ping pulse turn larson slider operation \ \ auto-width barber-phases progress-phases larson-phases \ slider-phases pulse-phases turn-phases \ \ to namespace ensemble create |
︙ | ︙ | |||
231 232 233 234 235 236 237 | } # # ## ### ##### ######## ############# ##################### proc ::cmdr::say::operation {lead script args} { debug.cmdr/say {} | | | > > | | > > > > > > > > | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | } # # ## ### ##### ######## ############# ##################### proc ::cmdr::say::operation {lead script args} { debug.cmdr/say {} set cmd {} ;# -play set delay 100 ;# -every set trailer OK ;# -trailer, -no-trailer while {1} { set o [lindex $args 0] switch -glob -- $o { -every { ;# int number argument set delay [lindex $args 1] set args [lrange $args 2 end] } -play { ;# cmd prefix argument set cmd [lindex $args 1] set args [lrange $args 2 end] } -no-trailer { ;# no argument set trailer {} set args [lrange $args 1 end] } -trailer { ;# string argument set trailer [lindex $args 1] set args [lrange $args 2 end] } -* { return -code error \ -errorcode {CMD SAY BAD-OPTION} \ "Unknown option $o, expected -every, -play, or -(no-)trailer" } default break } } add $lead lock-prefix |
︙ | ︙ | |||
269 270 271 272 273 274 275 | uplevel 1 $script } {*}$args on error {e o} { # General error => close line, and pass. line "" return {*}$o $e } on ok {e o} { rewind ; # remove animation output, leave only the lead | > | > | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | uplevel 1 $script } {*}$args on error {e o} { # General error => close line, and pass. line "" return {*}$o $e } on ok {e o} { rewind ; # remove animation output, leave only the lead if {$trailer ne {}} { line [color good $trailer] } } finally { # Stop ongoing animation, if any if {[llength $cmd]} { $animation done } } return $e |
︙ | ︙ | |||
413 414 415 416 417 418 419 420 421 422 423 424 425 426 | # # ## ### ##### ######## ############# ##################### ## turn animation proc ::cmdr::say::turn {} { debug.cmdr/say {} set phases [turn-phases] # Run the animation via the general class. return [animate::Im new -phases $phases] } # # ## ### ##### ######## ############# ##################### ## progress counter, n of max. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | # # ## ### ##### ######## ############# ##################### ## turn animation proc ::cmdr::say::turn {} { debug.cmdr/say {} set phases [turn-phases] # Run the animation via the general class. return [animate::Im new -phases $phases] } # # ## ### ##### ######## ############# ##################### ## slider animation proc ::cmdr::say::slider {args} { debug.cmdr/say {} array set config { -width {} -pattern *** } array set config $args set phases [slider-phases \ [auto-width $config(-width)] \ $config(-pattern)] # Run the animation via the general class. return [animate::Im new -phases $phases] } # # ## ### ##### ######## ############# ##################### ## larson scanner animation proc ::cmdr::say::larson {args} { debug.cmdr/say {} array set config { -width {} -pattern *** } array set config $args set phases [larson-phases \ [auto-width $config(-width)] \ $config(-pattern)] # Run the animation via the general class. return [animate::Im new -phases $phases] } # # ## ### ##### ######## ############# ##################### ## progress counter, n of max. |
︙ | ︙ |