cmdr
Check-in [d1f3c1d5ee]
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:Split the example file into many, and moved into the proper section.
Timelines: family | ancestors | descendants | both | say-more
Files: files | file ages | folders
SHA1:d1f3c1d5eef02009eab39f25df970550d080bf63
User & Date: andreask 2015-04-22 20:42:41
Context
2015-04-22
21:42
say - Start on tests, and extended package to support output redirection, making the tests easier. check-in: 2cc0a755b9 user: andreask tags: say-more
20:42
Split the example file into many, and moved into the proper section. check-in: d1f3c1d5ee user: andreask tags: say-more
20:19
Fix small issue, clear header in a multi-line prompt, this is a fixed part we must not redraw on retry under this new scheme. check-in: defa6f6ead user: andreask tags: say-more
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added examples/say-barber-phases.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

puts |[join [cmdr say barber-phases 16 {**  }] |\n|]|

exit

Added examples/say-barberpole-1.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# infinite barberpole
set B [cmdr say barberpole -width 30]
while {1} {
    after 100
    cmdr say rewind
    $B step
}

exit

Added examples/say-barberpole-2.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# infinite barberpole with a prefix
set B [cmdr say barberpole -width 30]
cmdr say add "download ... "
cmdr say lock-prefix
while {1} {
    #
    # fake download, unknown size, sync ... actual use:
    # - fcopy callback,
    # - http progress-callback
    # - tcllib transfer callback
    after 100
    #
    cmdr say rewind
    $B step
}

exit

Added examples/say-counter.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# progress counter.
set B [cmdr say progress-counter 100]
set i 0
cmdr say add "upload ... "
cmdr say lock-prefix
while {$i < 100} {
    #
    # fake upload, sync ... actual use:
    # - fcopy callback,
    # - http progress-callback
    # - tcllib transfer callback
    after 100
    #
    cmdr say rewind
    incr i
    $B step $i
}

exit

Added examples/say-general-1.





































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# scanner
set B [cmdr say animate -phases {
    {[***      ]}
    {[** *     ]}
    {[ ** *    ]}
    {[  ** *   ]}
    {[   ** *  ]}
    {[    ** * ]}
    {[     ** *]}
    {[      ***]}
    {[     * **]}
    {[    * ** ]}
    {[   * **  ]}
    {[  * **   ]}
    {[ * **    ]}
    {[* **     ]}
}]
while {1} {
    after 100
    cmdr say rewind
    $B step

    # NOTE: putting the rewind after the step means that we will
    # see the animation output only for a split second and the
    # erased/empty line for the 100 milli delay => the terminal
    # will look empty, with nothing happening.
}

exit

Added examples/say-general-2.

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# infinite slider - semi-barberpole
set B [cmdr say animate -phases {
    {[         ]}
    {[*        ]}
    {[**       ]}
    {[***      ]}
    {[* **     ]}
    {[ * **    ]}
    {[  * **   ]}
    {[   * **  ]}
    {[    * ** ]}
    {[     * **]}
    {[      * *]}
    {[       * ]}
    {[        *]}
}]
while {1} {
    after 100
    cmdr say rewind
    $B step
}

exit

Added examples/say-larson.







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# larson scanner
set B [cmdr say animate -phases [cmdr say larson-phases 9 ***]]
while {1} {
    after 100
    cmdr say rewind
    $B step

    # NOTE: putting the rewind after the step means that we will
    # see the animation output only for a split second and the
    # erased/empty line for the 100 milli delay => the terminal
    # will look empty, with nothing happening.
}

exit

Added examples/say-larson-phases.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

puts |[join [cmdr say larson-phases 23 ***] |\n|]|

exit

Added examples/say-percent.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# percent progress counter
set B [cmdr say percent -max 10000 -digits 2]
set i 0
cmdr say add "upload ... "
cmdr say lock-prefix
while {$i < 10000} {
    #
    # fake upload, sync ... actual use:
    # - fcopy callback,
    # - http progress-callback
    # - tcllib transfer callback
    after 10
    #
    cmdr say rewind
    incr i
    $B step $i
}

exit

Added examples/say-progress-1.



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# percent progress bar
set B [cmdr say progress -max 1000 -width 50]
set C [cmdr say percent  -max 1000]
set i 0
cmdr say add "upload ... "
cmdr say lock-prefix
while {$i < 1000} {
    #
    # fake upload, sync ... actual use:
    # - fcopy callback,
    # - http progress-callback
    # - tcllib transfer callback
    after 10
    #
    cmdr say rewind
    incr i
    cmdr say add \[
    $B step $i
    cmdr say add \]

    cmdr say add { }
    $C step $i
}
#after 10
#cmdr say rewind
cmdr say line { OK}

exit

Added examples/say-progress-2.











































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# percent progress bar, full width
set C [cmdr say percent -max 1000]

set  n [string length "upload ... \[\] "]
incr n [$C width]

set B [cmdr say progress -max 1000 -width -$n]
set i 0
cmdr say add "upload ... "
cmdr say lock-prefix
while {$i < 1000} {
    #
    # fake upload, sync ... actual use:
    # - fcopy callback,
    # - http progress-callback
    # - tcllib transfer callback
    after 10
    #
    cmdr say rewind
    incr i
    $C step $i
    cmdr say add { }

    cmdr say add \[
    $B step $i
    cmdr say add \]
}
after 1000
cmdr say rewind
cmdr say line { OK}

exit

Added examples/say-progress-phases.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

puts |[join [cmdr say progress-phases 6 * ^] |\n|]|

exit

Added examples/say-pulse.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# infinite pulse - semi-barberpole
set B [cmdr say animate \
	   -phases [cmdr say pulse-phases 3 [cmdr color {bg-blue white} *]]]
while {1} {
    after 100
    cmdr say rewind
    $B step
}

exit

Added examples/say-pulse-phases-1.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

puts |[join [cmdr say pulse-phases 6 *] |\n|]|

exit

Added examples/say-pulse-phases-2.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

puts |[join [cmdr say pulse-phases 3 [cmdr color red .]] |\n|]|

exit

Added examples/say-slider.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

# infinite slider - semi-barberpole
set B [cmdr say animate -phases [cmdr say slider-phases 9 ***]]
while {1} {
    after 100
    cmdr say rewind
    $B step
}

exit

Added examples/say-slider-phases.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5
package require cmdr::say

puts |[join [cmdr say slider-phases 9 ***] |\n|]|

exit

Deleted say-ex.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246

source color.tcl
source say.tcl

#debug on cmdr/say

if 0 {
    puts |[join [cmdr say larson-phases 23 ***] |\n|]|
    exit
}


if 0 {
    puts |[join [cmdr say pulse-phases 6 *] |\n|]|
    exit
}

if 0 {
    puts |[join [cmdr say pulse-phases 3 [cmdr color red .]] |\n|]|
    exit
}

if 0 {
    puts |[join [cmdr say progress-phases 6 * ^] |\n|]|
    exit
}

if 0 {
    # larson scanner
    set B [cmdr say animate -phases [cmdr say larson-phases 9 ***]]
    while {1} {
	after 100
	cmdr say rewind
	$B step

	# NOTE: putting the rewind after the step means that we will
	# see the animation output only for a split second and the
	# erased/empty line for the 100 milli delay => the terminal
	# will look empty, with nothing happening.
    }
}

if 0 {
    # scanner
    set B [cmdr say animate -phases {
	{[***      ]}
	{[** *     ]}
	{[ ** *    ]}
	{[  ** *   ]}
	{[   ** *  ]}
	{[    ** * ]}
	{[     ** *]}
	{[      ***]}
	{[     * **]}
	{[    * ** ]}
	{[   * **  ]}
	{[  * **   ]}
	{[ * **    ]}
	{[* **     ]}
    }]
    while {1} {
	after 100
	cmdr say rewind
	$B step

	# NOTE: putting the rewind after the step means that we will
	# see the animation output only for a split second and the
	# erased/empty line for the 100 milli delay => the terminal
	# will look empty, with nothing happening.
    }
}

if 0 {
    # infinite slider - semi-barberpole
    set B [cmdr say animate -phases [cmdr say slider-phases 9 ***]]
    while {1} {
	after 100
	cmdr say rewind
	$B step
    }
}

if 1 {
    # infinite slider - semi-barberpole
    set B [cmdr say animate -phases {
	{[         ]}
	{[*        ]}
	{[**       ]}
	{[***      ]}
	{[* **     ]}
	{[ * **    ]}
	{[  * **   ]}
	{[   * **  ]}
	{[    * ** ]}
	{[     * **]}
	{[      * *]}
	{[       * ]}
	{[        *]}
    }]
    while {1} {
	after 100
	cmdr say rewind
	$B step
    }
}

if 0 {
    # infinite pulse - semi-barberpole
    set B [cmdr say animate \
	       -phases [cmdr say pulse-phases 3 [cmdr color {bg-blue white} *]]]
    while {1} {
	after 100
	cmdr say rewind
	$B step
    }
}

if 0 {
    # infinite barberpole
    set B [cmdr say barberpole -width 30]
    while {1} {
	after 100
	cmdr say rewind
	$B step
    }
}

if 0 {
    # infinite barberpole with a prefix
    set B [cmdr say barberpole -width 30]
    cmdr say add "download ... "
    cmdr say lock-prefix
    while {1} {
	#
	# fake download, unknown size, sync ... actual use:
	# - fcopy callback,
	# - http progress-callback
	# - tcllib transfer callback
	after 100
	#
	cmdr say rewind
	$B step
    }
}

if 0 {
    # progress counter.
    set B [cmdr say progress-counter 100]
    set i 0
    cmdr say add "upload ... "
    cmdr say lock-prefix
    while {$i < 100} {
	#
	# fake upload, sync ... actual use:
	# - fcopy callback,
	# - http progress-callback
	# - tcllib transfer callback
	after 100
	#
	cmdr say rewind
	incr i
	$B step $i
    }
}

if 0 {
    # percent progress counter
    set B [cmdr say percent -max 10000 -digits 2]
    set i 0
    cmdr say add "upload ... "
    cmdr say lock-prefix
    while {$i < 10000} {
	#
	# fake upload, sync ... actual use:
	# - fcopy callback,
	# - http progress-callback
	# - tcllib transfer callback
	after 10
	#
	cmdr say rewind
	incr i
	$B step $i
    }
}

if 0 {
    # percent progress bar
    set B [cmdr say progress -max 1000 -width 50]
    set C [cmdr say percent  -max 1000]
    set i 0
    cmdr say add "upload ... "
    cmdr say lock-prefix
    while {$i < 1000} {
	#
	# fake upload, sync ... actual use:
	# - fcopy callback,
	# - http progress-callback
	# - tcllib transfer callback
	after 10
	#
	cmdr say rewind
	incr i
	cmdr say add \[
	$B step $i
	cmdr say add \]

	cmdr say add { }
	$C step $i
    }
    #after 10
    #cmdr say rewind
    cmdr say line { OK}
}

if 0 {
    # percent progress bar, full width
    set C [cmdr say percent -max 1000]

    set  n [string length "upload ... \[\] "]
    incr n [$C width]

    set B [cmdr say progress -max 1000 -width -$n]
    set i 0
    cmdr say add "upload ... "
    cmdr say lock-prefix
    while {$i < 1000} {
	#
	# fake upload, sync ... actual use:
	# - fcopy callback,
	# - http progress-callback
	# - tcllib transfer callback
	after 10
	#
	cmdr say rewind
	incr i
	$C step $i
	cmdr say add { }

	cmdr say add \[
	$B step $i
	cmdr say add \]
    }
    after 1000
    cmdr say rewind
    cmdr say line { OK}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<