cmdr
Check-in [8ff369076f]
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:Fix inadvertent split of trunk
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8ff369076fcf562a02ca3f56f948064fee090b9d
User & Date: andreask 2014-05-16 00:44:49
Context
2014-05-21
06:38
cmdr::actor - Fixed typo in error message check-in: a62b20fe7b user: aku tags: trunk
2014-05-16
00:46
Moved to "mistake". This requires more thought. At issue is that the "recently" made validation types "wchan" and "rwchan" generate externally visible changes as part of their creation of the internal representation. Namely, they create a file. This is problematic as in some situations the VT is called on to simply check if the input is ok, and nothing more. And while the code path in question does call on the "release" method of the VT to cleanup the internal rep the external side-effect remains. The change here went with extending "release" to allow it to undo the external effect as well, on request. This then requires determining when to do that, and when not. And that is difficult as the same APIs are used internally and given to the user. A better path might be to change the VT API. For compatibility we cannot change "validate", it has to keep doing validation + conversion. New methods would be required for each of the two parts. Then the framework can defer the creation of the int. rep until the last possible moment, i.e. when the user needs it. While the other places only requiring validation limit themselves to that, and no side-effects, in- or outside of memory. ---- Extended the std validation types to support an undo flag for their release method. Closed-Leaf check-in: 0be2930b72 user: andreask tags: mistake
00:44
Fix inadvertent split of trunk check-in: 8ff369076f user: andreask tags: trunk
00:29
cmdr::actor - New feature "common -extend", enabling extension of a block instead of overwriting it. check-in: 7ab77ead21 user: aku tags: trunk
2014-05-07
21:58
cmdr::validate (rpath) - Fixed bug in the path check. Removed bogus test for directory. This VT accepts files too. Bumped to version 1.3.1. check-in: e7ed76dd06 user: andreask tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to help_json.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
81
82
83
84
85
86
87

88
89
90

91
92
93
94
95
96
97
...
197
198
199
200
201
202
203
204
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## CMDR - Help - JSON format. Not available by default.
## Require this package before creation a commander, so that the
## mdr::help heuristics see and automatically integrate the format.

# @@ Meta Begin
# Package cmdr::help::json 1.0
# Meta author   {Andreas Kupries}
# Meta location https://core.tcl.tk/akupries/cmdr
# Meta platform tcl
# Meta summary     Formatting help as JSON object.
# Meta description Formatting help as JSON object.
# Meta subject {command line}
# Meta require {Tcl 8.5-}
................................................................................
namespace eval ::cmdr::help::format::JSON {}

proc ::cmdr::help::format::JSON::acategory {path cmds subc} {
    set name [lindex $path end]

    # With struct::list map we could then also re-use alist.
    set commands {}

    foreach def [lsort -dict -unique [dict get $cmds $path]] {
	lassign $def cname _
	lappend commands [json::write string $cname]

    }

    set sections {}
    if {[dict exists $subc $path]} {
	# Add the sub-categories, if any.
	foreach c [lsort -dict -unique [dict get $subc $path]] {
	    lappend sections [acategory [linsert $path end $c] $cmds $subc]
................................................................................
proc ::cmdr::help::format::JSON::astring {string} {
    regsub -all -- {[ \n\t]+} $string { } string
    return [json::write string [string trim $string]]
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::help::json 1.0







|







 







>



>







 







|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
199
200
201
202
203
204
205
206
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## CMDR - Help - JSON format. Not available by default.
## Require this package before creation a commander, so that the
## mdr::help heuristics see and automatically integrate the format.

# @@ Meta Begin
# Package cmdr::help::json 1.0.1
# Meta author   {Andreas Kupries}
# Meta location https://core.tcl.tk/akupries/cmdr
# Meta platform tcl
# Meta summary     Formatting help as JSON object.
# Meta description Formatting help as JSON object.
# Meta subject {command line}
# Meta require {Tcl 8.5-}
................................................................................
namespace eval ::cmdr::help::format::JSON {}

proc ::cmdr::help::format::JSON::acategory {path cmds subc} {
    set name [lindex $path end]

    # With struct::list map we could then also re-use alist.
    set commands {}
    if {[dict exists $cmds $path]} {
	foreach def [lsort -dict -unique [dict get $cmds $path]] {
	    lassign $def cname _
	    lappend commands [json::write string $cname]
	}
    }

    set sections {}
    if {[dict exists $subc $path]} {
	# Add the sub-categories, if any.
	foreach c [lsort -dict -unique [dict get $subc $path]] {
	    lappend sections [acategory [linsert $path end $c] $cmds $subc]
................................................................................
proc ::cmdr::help::format::JSON::astring {string} {
    regsub -all -- {[ \n\t]+} $string { } string
    return [json::write string [string trim $string]]
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::help::json 1.0.1

Changes to help_tcl.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
77
78
79
80
81
82
83

84
85

86
87
88
89
90
91
92
...
176
177
178
179
180
181
182
183
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## CMDR - Help - TCL format. Not available by default.
## Require this package before creation a commander, so that the
## mdr::help heuristics see and automatically integrate the format.

# @@ Meta Begin
# Package cmdr::help::tcl 1.0
# Meta author   {Andreas Kupries}
# Meta location https://core.tcl.tk/akupries/cmdr
# Meta platform tcl
# Meta summary     Formatting help as TCL data structure (nested dict/list).
# Meta description Formatting help as TCL data structure (nested dict/list).
# Meta subject {command line}
# Meta require {Tcl 8.5-}
................................................................................
namespace eval ::cmdr::help::format::TCL {}

proc ::cmdr::help::format::TCL::acategory {path cmds subc} {
    set name [lindex $path end]

    # With struct::list map we could then also re-use alist.
    set commands {}

    foreach def [lsort -dict -unique [dict get $cmds $path]] {
	lappend commands [lindex $def 0]

    }

    set sections {}
    if {[dict exists $subc $path]} {
	# Add the sub-categories, if any.
	foreach c [lsort -dict -unique [dict get $subc $path]] {
	    lappend sections [acategory [linsert $path end $c] $cmds $subc]
................................................................................
proc ::cmdr::help::format::TCL::astring {string} {
    regsub -all -- {[ \n\t]+} $string { } string
    return [string trim $string]
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::help::tcl 1.0







|







 







>
|
|
>







 







|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
178
179
180
181
182
183
184
185
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## CMDR - Help - TCL format. Not available by default.
## Require this package before creation a commander, so that the
## mdr::help heuristics see and automatically integrate the format.

# @@ Meta Begin
# Package cmdr::help::tcl 1.0.1
# Meta author   {Andreas Kupries}
# Meta location https://core.tcl.tk/akupries/cmdr
# Meta platform tcl
# Meta summary     Formatting help as TCL data structure (nested dict/list).
# Meta description Formatting help as TCL data structure (nested dict/list).
# Meta subject {command line}
# Meta require {Tcl 8.5-}
................................................................................
namespace eval ::cmdr::help::format::TCL {}

proc ::cmdr::help::format::TCL::acategory {path cmds subc} {
    set name [lindex $path end]

    # With struct::list map we could then also re-use alist.
    set commands {}
    if {[dict exists $cmds $path]} {
	foreach def [lsort -dict -unique [dict get $cmds $path]] {
	    lappend commands [lindex $def 0]
	}
    }

    set sections {}
    if {[dict exists $subc $path]} {
	# Add the sub-categories, if any.
	foreach c [lsort -dict -unique [dict get $subc $path]] {
	    lappend sections [acategory [linsert $path end $c] $cmds $subc]
................................................................................
proc ::cmdr::help::format::TCL::astring {string} {
    regsub -all -- {[ \n\t]+} $string { } string
    return [string trim $string]
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::help::tcl 1.0.1

Changes to validate.tcl.

385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
...
536
537
538
539
540
541
542
543
544
    debug.cmdr/validate {}
    if {[Ok $x]} { return $x }
    fail $p RPATH "an existing readable path" $x
}

proc ::cmdr::validate::rpath::Ok {path} {
    if {![file exists      $path]} {return 0}
    if {![file isdirectory $path]} {return 0}
    if {![file readable    $path]} {return 0}
    return 1
}

# # ## ### ##### ######## ############# #####################
## Any path, existing and read/writable.

................................................................................
    if {![file readable $path]} {return 0}
    if {![file writable $path]} {return 0}
    return 1
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::validate 1.3
return







<







 







|

385
386
387
388
389
390
391

392
393
394
395
396
397
398
...
535
536
537
538
539
540
541
542
543
    debug.cmdr/validate {}
    if {[Ok $x]} { return $x }
    fail $p RPATH "an existing readable path" $x
}

proc ::cmdr::validate::rpath::Ok {path} {
    if {![file exists   $path]} {return 0}

    if {![file readable $path]} {return 0}
    return 1
}

# # ## ### ##### ######## ############# #####################
## Any path, existing and read/writable.

................................................................................
    if {![file readable $path]} {return 0}
    if {![file writable $path]} {return 0}
    return 1
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::validate 1.3.1
return