diff --git a/scriptlib/utils/pwsh/consolemode_server_async.ps1 b/scriptlib/utils/pwsh/consolemode_server_async.ps1 index 1d188f6b..e968982e 100644 --- a/scriptlib/utils/pwsh/consolemode_server_async.ps1 +++ b/scriptlib/utils/pwsh/consolemode_server_async.ps1 @@ -59,7 +59,7 @@ enum ConsoleModeInputFlags ENABLE_QUICK_EDIT_MODE = 0x0040 ENABLE_EXTENDED_FLAGS = 0x0080 ENABLE_AUTO_POSITION = 0x0100 - ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0200 + ENABLE_VIRTUAL_TERMINAL_INPUT = 0x0200 }; [Flags()] @@ -68,6 +68,7 @@ enum ConsoleModeOutputFlags ENABLE_PROCESSED_OUTPUT = 0x0001 ENABLE_WRAP_AT_EOL_OUTPUT = 0x0002 ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 + DISABLE_NEWLINE_AUTO_RETURN = 0x0008 }; if (!('NativeConsoleMethods' -as [System.Type])) { diff --git a/src/lib/app-punkshell/punkshell.tcl b/src/lib/app-punkshell/punkshell.tcl index 828d6da8..515e8c10 100644 --- a/src/lib/app-punkshell/punkshell.tcl +++ b/src/lib/app-punkshell/punkshell.tcl @@ -248,10 +248,97 @@ dict with prevglobal {} set exitinfo [dict create] switch -glob -nocase -- $script_or_kit { lib:* { + set exitinfo {} #scriptlib - puts stderr "lib:* todo" + #There may be one or more colons after lib + set cposn [string first : $script_or_kit] + set script_or_kit [string trimleft [string range $script_or_kit $cposn+1 end] :] + if {[file pathtype $script_or_kit] eq "relative"} { + set has_globchars [regexp {[*?]} $script_or_kit] ;#basic globs only? + + + set exepath [file dirname [file normalize [file join [info nameofexecutable] ___]]] ;#symlink resolve - review should we resolve scriptlib relative to a symlink too? + set kit_libdir "" ;#metakit or zipkit libdir + set known_extensions [list .tcl .py .pl .ps1 .sh] ;#review + set ext [file extension $script_or_kit] + if {[string tolower $ext] ni $known_extensions} { + #only .tcl scripts allowed to be called extensionlessly + set scriptname $script_or_kit.tcl + } else { + set scriptname $script_or_kit + } + set lower_ext [string tolower [file extension $scriptname]] + if {$lower_ext in {.tcl .kit}} { + set has_zipfs_command [expr {[info commands ::tcl::zipfs::root] ne ""}] + set kit_base "" + if {$has_zipfs_command && [file exists [tcl::zipfs::root]]} { + set kit_base [tcl::zipfs::root] + } elseif {[file type $exepath] eq "directory"} { + set kit_base $exepath + } + if {$has_zipfs_command && [file exists $kit_base/app/scriptlib]} { + set kit_libdir $kit_base/app/scriptlib + } elseif {[file exists $exepath/scriptlib]} { + set kit_libdir $exepath/scriptlib + } + + #partly for performance benefit - we don't allow overriding of vfs internal scripts. + #Only additional scripts can be provided by the bin/scriptlib or ../bin/scriptlib folders + if {$kit_libdir ne "" && [file exists $kit_libdir/$scriptname]} { + switch -- $lower_ext { + .tcl { + set exitinfo [punkshell::do_script $kit_libdir/$scriptname {*}$arglist] + } + .kit { + set exitinfo [punkshell::do_tclkit $kit_libdir/$scriptname "no_repl" {*}$arglist] + } + } + } else { + #fallback to external filesystem + set exedir [file dirname $exepath] + set bin_scripts [file join $exedir scriptlib] + set binsibling_scripts [file join [file dirname $exedir] scriptlib] + set script_check_paths [list] + if {[file exists $bin_scripts]} { + lappend script_check_paths $bin_scripts/$scriptname + } + if {[file exists $binsibling_scripts]} { + lappend script_check_paths $binsibling_scripts/$scriptname + } + if {[llength $script_check_paths]} { + foreach check_path $script_check_paths { + if {[file exists $check_path]} { + switch -- $lower_ext { + .tcl { + set exitinfo [punkshell::do_script $check_path {*}$arglist] + } + .kit { + set exitinfo [punkshell::do_tclkit $check_path "no_repl" {*}$arglist] + } + } + break + } + } + } else { + puts stderr "script $script_or_kit not found in vfs or in filesystem relative to $exedir" + puts stderr "valid locations:" + if {$kit_base ne ""} { + puts stderr " $kit_base/scriptlib/$scriptname" + } + puts stderr " $bin_scripts/$scriptname" + puts stderr " $binsibling_scripts/$scriptname" + } + } + } else { + puts stderr "No current support for extension [file extension $scriptname]" + } + + } else { + puts stderr "Path supplied to lib: must be a relative path" + } } *.tcl { + #except for lib:*.tcl set exitinfo [punkshell::do_script $script_or_kit {*}$arglist] } *.kit { diff --git a/src/lib/app-shellspy/shellspy.tcl b/src/lib/app-shellspy/shellspy.tcl index 2994077e..7c4a3044 100644 --- a/src/lib/app-shellspy/shellspy.tcl +++ b/src/lib/app-shellspy/shellspy.tcl @@ -33,9 +33,9 @@ set arg1 [lindex $::argv 0] if {[file extension $arg1] in [list .tCl]} { set ::argv [lrange $::argv 1 end] set ::argc [llength $::argv] - + set exedir [file dirname [info nameofexecutable]] - set binscripts [file join $exedir scriptlib] + set binscripts [file join $exedir scriptlib] if {[file exists $binscripts]} { set libdir $binscripts } else { diff --git a/src/modules/punk-0.1.tm b/src/modules/punk-0.1.tm index 1e09252d..6bf529eb 100644 --- a/src/modules/punk-0.1.tm +++ b/src/modules/punk-0.1.tm @@ -6321,7 +6321,10 @@ namespace eval punk { #useful for aliases e.g treemore -> xmore tree proc xmore {args} { if {[llength $args]} { - uplevel #0 [list {*}$args | more] + #more is older and not as featureful as less + #more importantly - at least some implementations (msys on windows) can skip output lines - unknown as to why + #uplevel #0 [list {*}$args | more] + uplevel #0 [list {*}$args | less -X] ;#-X to avoid use of alternate-screen } else { error "usage: punk::xmore args where args are run as {*}\$args | more" } diff --git a/src/modules/punk/ansi-999999.0a1.0.tm b/src/modules/punk/ansi-999999.0a1.0.tm index dcb22eff..e720624a 100644 --- a/src/modules/punk/ansi-999999.0a1.0.tm +++ b/src/modules/punk/ansi-999999.0a1.0.tm @@ -3130,10 +3130,10 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu } } undt { - #CSI 58:5 UNDERLINE COLOR PALETTE INDEX - #CSI 58 : 5 : INDEX m - #variable TERM_colour_map - #256 colour underline by Xterm name or by integer + # CSI 58:5 UNDERLINE COLOR PALETTE INDEX + # CSI 58 : 5 : INDEX m + # variable TERM_colour_map + # 256 colour underline by Xterm name or by integer #name is xterm name or colour index from 0 - 255 set cc [tcl::string::tolower [tcl::string::range $i 5 end]] if {[tcl::string::is integer -strict $cc] & $cc < 256} { @@ -5202,9 +5202,10 @@ tcl::namespace::eval punk::ansi { #tcl::dict::set codestate_empty undersingle "" #tcl::dict::set codestate_empty underdouble "" #tcl::dict::set codestate_empty undercurly "" - #tcl::dict::set codestate_empty underdottedn "" + #tcl::dict::set codestate_empty underdotted "" #tcl::dict::set codestate_empty underdashed "" + tcl::dict::set codestate_empty blink "" ;#5 or 6 for slow/fast, 25 for off tcl::dict::set codestate_empty reverse "" ;#7 on 27 off tcl::dict::set codestate_empty hide "" ;#8 on 28 off @@ -5234,6 +5235,8 @@ tcl::namespace::eval punk::ansi { tcl::dict::set codestate_empty fg "" ;#30-37 + 90-97 tcl::dict::set codestate_empty bg "" ;#40-47 + 100-107 + variable metastate_empty + tcl::dict::set metastate_empty underline_active "" ;#a meta state for whether underlines are on|off - values 1,0,"" #misnomer should have been sgr_merge_args ? :/ #as a common case optimisation - it will not merge a single element list, even if that code contains redundant elements @@ -5269,6 +5272,7 @@ tcl::namespace::eval punk::ansi { #(use punk::ansi::ta::split_codes_single) proc sgr_merge_singles {codelist args} { variable codestate_empty + variable metastate_empty variable defaultopts_sgr_merge_singles set opts $defaultopts_sgr_merge_singles foreach {k v} $args { @@ -5284,8 +5288,8 @@ tcl::namespace::eval punk::ansi { } set othercodes [list] - set codestate $codestate_empty - set codestate_initial $codestate_empty ;#keep a copy for resets. + set codestate $codestate_empty ;#take copy as we need the empty state for resets + set metastate $metastate_empty set did_reset 0 #we should also handle 8bit CSI here? mixed \x1b\[ and \x9b ? Which should be used in the merged result? @@ -5345,7 +5349,8 @@ tcl::namespace::eval punk::ansi { switch -- $codeint { "" - 0 { if {![tcl::dict::get $opts -filter_reset]} { - set codestate $codestate_initial + set codestate $codestate_empty + set metastate $metastate_empty set did_reset 1 } } @@ -5371,27 +5376,42 @@ tcl::namespace::eval punk::ansi { #e.g hyper on windows if {[llength $paramsplit] == 1} { tcl::dict::set codestate underline 4 + if {[tcl::dict::get $codestate underextended] eq "4:0"} { + tcl::dict::set codestate underextended "" + } + tcl::dict::set metastate underline_active 1 } else { switch -- [lindex $paramsplit 1] { 0 { #no *extended* underline #tcl::dict::set codestate underline 24 tcl::dict::set codestate underextended 4:0 ;#will not turn off SGR standard underline if term doesn't support extended + tcl::dict::set metastate underline_active 0 } 1 { + #single tcl::dict::set codestate underextended 4:1 + tcl::dict::set metastate underline_active 1 } 2 { + #double tcl::dict::set codestate underextended 4:2 + tcl::dict::set metastate underline_active 1 } 3 { + #curly tcl::dict::set codestate underextended "4:3" + tcl::dict::set metastate underline_active 1 } 4 { + #dotted tcl::dict::set codestate underextended "4:4" + tcl::dict::set metastate underline_active 1 } 5 { + #dashed tcl::dict::set codestate underextended "4:5" + tcl::dict::set metastate underline_active 1 } } @@ -5431,6 +5451,7 @@ tcl::namespace::eval punk::ansi { 24 { tcl::dict::set codestate underline 24 ;#off tcl::dict::set codestate underextended "4:0" ;#review + tcl::dict::set metastate underline_active 0 } 25 { tcl::dict::set codestate blink 25 ;#off @@ -5519,11 +5540,11 @@ tcl::namespace::eval punk::ansi { } 58 { #nonstandard - #256 colour or rgb + # 256 colour or rgb if {[tcl::string::first : $p] < 0} { switch -- [lindex $plist $i+1] { 5 { - #256 - 1 more param + # 256 - 1 more param tcl::dict::set codestate underlinecolour "58\;5\;[lindex $plist $i+2]" incr i 2 } @@ -5544,10 +5565,12 @@ tcl::namespace::eval punk::ansi { 60 { tcl::dict::set codestate ideogram_underline 60 tcl::dict::set codestate ideogram_clear "" + #nounderline effect? review! } 61 { tcl::dict::set codestate ideogram_doubleunderline 61 tcl::dict::set codestate ideogram_clear "" + #nounderline effect? review! } 62 { tcl::dict::set codestate ideogram_overline 62 @@ -5566,6 +5589,7 @@ tcl::namespace::eval punk::ansi { #review - we still need to pass through the ideogram_clear in case something understands it tcl::dict::set codestate ideogram_underline "" tcl::dict::set codestate ideogram_doubleunderline "" + tcl::dict::set codestate ideogram_overline "" tcl::dict::set codestate ideogram_doubleoverline "" } @@ -5623,6 +5647,7 @@ tcl::namespace::eval punk::ansi { } } underlinecolour - underextended { + #review append unmergeable "${v}\;" } default { @@ -5640,7 +5665,11 @@ tcl::namespace::eval punk::ansi { "" {} default { switch -- $k { - underlinecolour - underextended { + underlinecolour { + append unmergeable "${v}\;" + } + underextended { + #review append unmergeable "${v}\;" } default { diff --git a/src/modules/punk/args-999999.0a1.0.tm b/src/modules/punk/args-999999.0a1.0.tm index fa8b6564..b699393b 100644 --- a/src/modules/punk/args-999999.0a1.0.tm +++ b/src/modules/punk/args-999999.0a1.0.tm @@ -3608,7 +3608,12 @@ tcl::namespace::eval punk::args { #A_PREFIX can resolve to empty string if colour off #we then want to display underline instead set A_PREFIX [a+ underline] - set A_PREFIXEND [a+ nounderline]\u200B ;#padding will take ANSI from last char - so add a zero width space + #set A_PREFIXEND [a+ nounderline]\u200B ;#padding will take ANSI from last char - so add a zero width space (zwsp) + set A_PREFIXEND [a+ nounderline] + #review - zwsp problematic on older terminals that print it visibly + #- especially if they also lie about cursor position after it's emitted. + #so although the zwsp fixes the issue where the underline extends to rhs padding if all text was underlined, + #It's probably best fixed in the padding functionality. } else { set A_PREFIXEND $RST } diff --git a/src/modules/punk/console-999999.0a1.0.tm b/src/modules/punk/console-999999.0a1.0.tm index f9f9bcef..1950ab8f 100644 --- a/src/modules/punk/console-999999.0a1.0.tm +++ b/src/modules/punk/console-999999.0a1.0.tm @@ -211,9 +211,9 @@ namespace eval punk::console { set result [dict create] if {"output" in $channels} { #note setting stdout makes stderr have the same settings - ie there is really only one output to configure - set h_out [twapi::get_console_handle stdout] + set h_out [twapi::get_console_handle stdout] set oldmode [twapi::GetConsoleMode $h_out] - set newmode [expr {$oldmode | 4}] + set newmode [expr {$oldmode | 4}] twapi::SetConsoleMode $h_out $newmode dict set result output [list from $oldmode to $newmode] } @@ -255,7 +255,7 @@ namespace eval punk::console { #as above - configuring stdout does stderr too set h_out [twapi::get_console_handle stdout] set oldmode [twapi::GetConsoleMode $h_out] - set newmode [expr {$oldmode & ~4}] + set newmode [expr {$oldmode & ~4}] twapi::SetConsoleMode $h_out $newmode dict set result output [list from $oldmode to $newmode] } diff --git a/src/modules/punk/mix/cli-999999.0a1.0.tm b/src/modules/punk/mix/cli-999999.0a1.0.tm index 76ee6f29..80ef399a 100644 --- a/src/modules/punk/mix/cli-999999.0a1.0.tm +++ b/src/modules/punk/mix/cli-999999.0a1.0.tm @@ -507,6 +507,7 @@ namespace eval punk::mix::cli { -punkcheck_eventobj "\uFFFF"\ -glob *.tm\ -podglob #modpod-*\ + -tarjarglob #tarjar-*\ ] set opts [dict merge $defaults $args] @@ -519,6 +520,7 @@ namespace eval punk::mix::cli { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- set fileglob [dict get $opts -glob] set podglob [dict get $opts -podglob] + set tarjarglob [dict get $opts -tarjarglob] if {![string match "*.tm" $fileglob]} { error "build_modules_from_source_to_base -glob '$fileglob' doesn't seem to target tcl modules." } @@ -580,6 +582,10 @@ namespace eval punk::mix::cli { foreach podpath $src_pods { dict set process_modules $podpath [dict create -type pod] } + set src_tarjars [glob -nocomplain -dir $current_source_dir -type d -tail $tarjarglob] + foreach tarjarpath $src_tarjars { + dict set process_modules $tarjarpath [dict create -type tarjar] + } set src_modules [glob -nocomplain -dir $current_source_dir -type f -tail $fileglob] foreach modulepath $src_modules { dict set process_modules $modulepath [dict create -type file] @@ -801,8 +807,173 @@ namespace eval punk::mix::cli { } } tarjar { + #maint - overall code structure same as pod - refactor? #basename may still contain #tarjar- #to be obsoleted - update modpod to (optionally) use vfs::tar ? + if {[string match #tarjar-* $basename]} { + set basename [string range $basename 8 end] + } else { + error "build_modules_from_source_to_base, tarjar, unexpected basename $basename" ;#shouldn't be possible with default tarjarglob - review - why is tarjarglob configurable? + } + set versionfile $current_source_dir/$basename-buildversion.txt ;#needs to be added in targetset_addsource to trigger rebuild if changed (only when magicversion in use) + if {$tmfile_versionsegment eq $magicversion} { + set versionfiledata "" + if {![file exists $versionfile]} { + puts stderr "\nWARNING: Missing buildversion text file: $versionfile" + puts stderr "Using version 0.1 - create $versionfile containing the desired version number as the top line to avoid this warning\n" + set module_build_version "0.1" + } else { + set fd [open $versionfile r] + set versionfiledata [read $fd]; close $fd + set ln0 [lindex [split $versionfiledata \n] 0] + set ln0 [string trim $ln0]; set ln0 [string trim $ln0 \r] + if {![util::is_valid_tm_version $ln0]} { + puts stderr "ERROR: build version '$ln0' specified in $versionfile is not suitable. Please ensure a proper version number is at first line of file" + exit 3 + } + set module_build_version $ln0 + } + } else { + set module_build_version $tmfile_versionsegment + } + + set buildfolder $current_source_dir/_build + file mkdir $buildfolder + # -- --- + set config [dict create\ + -glob *\ + -max_depth 100\ + ] + set had_error 0 + + # -max_depth -1 for no limit + set build_installername tarjars_in_$current_source_dir + set build_installer [punkcheck::installtrack new $build_installername $buildfolder/.punkcheck] + $build_installer set_source_target $current_source_dir/$modpath $buildfolder + set build_event [$build_installer start_event $config] + # -- --- + set podtree_copy $buildfolder/#tarjar-$basename-$module_build_version + set modulefile $buildfolder/$basename-$module_build_version.tm + + + $build_event targetset_init INSTALL $podtree_copy + $build_event targetset_addsource $current_source_dir/$modpath + if {$tmfile_versionsegment eq $magicversion} { + $build_event targetset_addsource $versionfile + } + if {\ + [llength [dict get [$build_event targetset_source_changes] changed]]\ + || [llength [$build_event get_targets_exist]] < [llength [$build_event get_targets]]\ + } { + $build_event targetset_started + if {$did_skip} {set did_skip 0; puts -nonewline stdout \n} + + set delete_failed 0 + if {[file exists $buildfolder/]} { + puts stderr "deleting existing _build copy at $podtree_copy" + if {[catch { + file delete -force $podtree_copy + } errMsg]} { + puts stderr "[punk::ansi::a+ red]deletion of _build copy at $podtree_copy failed: $errMsg[punk::ansi::a]" + set delete_failed 1 + } + } + if {!$delete_failed} { + puts stdout "copying.." + puts stdout "$current_source_dir/$modpath" + puts stdout "to:" + puts stdout "$podtree_copy" + file copy $current_source_dir/$modpath $podtree_copy + if {$tmfile_versionsegment eq $magicversion} { + set tmfile $buildfolder/#tarjar-$basename-$module_build_version/#tarjar-loadscript-$basename.tcl + #we don't need to modify version or name of the loadscript + #just do basic sanity check that the file exists + if {![file exists $tmfile]} { + set had_error 1 + lappend notes "tarjar_loadscript_missing" + } + } + #delete and regenerate .tm + set notes [list] + if {[catch { + file delete $buildfolder/$basename-$module_build_version.tm + } err]} { + set had_error 1 + lappend notes "tm_delete_failed" + } + #create ordinary tar file without using external executable + package require tar ;#tcllib + set tarfile $buildfolder/$basename-$module_build_version.tm ;#ordinary tar file (no compression - store) + set wd [pwd] + cd $buildfolder + puts "tar::create $tarfile #tarjar-$basename-$module_build_version" + if {[catch { + tar::create $tarfile #tarjar-$basename-$module_build_version + } errMsg]} { + set had_error 1 + puts stderr "tar::create $tarfile failed with msg\n $errMsg" + lappend notes "tar_create_failed" + } + cd $wd + + if {![file exists $tarfile]} { + set had_error 1 + lappend notes "tar_result_missing" + } + + + if {$had_error} { + $build_event targetset_end FAILED -note [join $notes ,] + } else { + # -- ---------- + $build_event targetset_end OK + # -- ---------- + } + } else { + $build_event targetset_end FAILED -note "could not delete $podtree_copy" + } + + } else { + puts -nonewline stderr "T" + set did_skip 1 + #set file_record [punkcheck::installfile_skipped_install $basedir $file_record] + $build_event targetset_end SKIPPED + } + $build_event destroy + $build_installer destroy + + #JMN - review + if {!$had_error} { + $event targetset_init INSTALL $target_module_dir/$basename-$module_build_version.tm + $event targetset_addsource $modulefile + if {\ + [llength [dict get [$event targetset_source_changes] changed]]\ + || [llength [$event get_targets_exist]] < [llength [$event get_targets]]\ + } { + + $event targetset_started + # -- --- --- --- --- --- + if {$did_skip} {set did_skip 0; puts -nonewline stdout \n} + lappend module_list $modulefile + if {[catch { + file copy -force $modulefile $target_module_dir + } errMsg]} { + puts stderr "FAILED to copy tarjar module $modulefile to $target_module_dir" + $event targetset_end FAILED -note "could not copy $modulefile" + } else { + puts stderr "Copied tarjar module $modulefile to $target_module_dir" + # -- --- --- --- --- --- + $event targetset_end OK -note "tarjar" + } + } else { + puts -nonewline stderr "t" + set did_skip 1 + if {$is_interesting} { + puts stderr "$modulefile [$event targetset_source_changes]" + } + $event targetset_end SKIPPED + } + } } file { @@ -829,39 +1000,40 @@ namespace eval punk::mix::cli { if {[file exists $current_source_dir/#tarjar-$basename-$magicversion]} { - #rebuild the .tm from the #tarjar + #rebuilding the .tm from the #tarjar already handled above + puts -nonewline stderr "-" - if {[file exists $current_source_dir/#tarjar-$basename-$magicversion/DESCRIPTION.txt]} { + #if {[file exists $current_source_dir/#tarjar-$basename-$magicversion/DESCRIPTION.txt]} { - } else { + #} else { - } - #REVIEW - should be in same structure/depth as $target_module_dir in _build? + #} + ##REVIEW - should be in same structure/depth as $target_module_dir in _build? - #TODO - set buildfolder $current_sourcedir/_build - file mkdir $buildfolder + ##TODO + #set buildfolder $current_sourcedir/_build + #file mkdir $buildfolder - set tmfile $buildfolder/$basename-$module_build_version.tm - file delete -force $buildfolder/#tarjar-$basename-$module_build_version - file delete -force $tmfile + #set tmfile $buildfolder/$basename-$module_build_version.tm + #file delete -force $buildfolder/#tarjar-$basename-$module_build_version + #file delete -force $tmfile - file copy -force $current_source_dir/#tarjar-$basename-$magicversion $buildfolder/#tarjar-$basename-$module_build_version - # - #bsdtar doesn't seem to work.. or I haven't worked out the right options? - #exec tar -cvf $buildfolder/$basename-$module_build_version.tm $buildfolder/#tarjar-$basename-$module_build_version - package require tar - tar::create $tmfile $buildfolder/#tarjar-$basename-$module_build_version - if {![file exists $tmfile]} { - puts stdout "ERROR: failed to build tarjar file $tmfile" - exit 4 - } - #copy the file? - #set target $target_module_dir/$basename-$module_build_version.tm - #file copy -force $tmfile $target + #file copy -force $current_source_dir/#tarjar-$basename-$magicversion $buildfolder/#tarjar-$basename-$module_build_version + ## + ##bsdtar doesn't seem to work.. or I haven't worked out the right options? + ##exec tar -cvf $buildfolder/$basename-$module_build_version.tm $buildfolder/#tarjar-$basename-$module_build_version + #package require tar + #tar::create $tmfile $buildfolder/#tarjar-$basename-$module_build_version + #if {![file exists $tmfile]} { + # puts stdout "ERROR: failed to build tarjar file $tmfile" + # exit 4 + #} + ##copy the file? + ##set target $target_module_dir/$basename-$module_build_version.tm + ##file copy -force $tmfile $target - lappend module_list $tmfile + #lappend module_list $tmfile } else { #assume that either the .tm is not a tarjar - or the tarjar dir is capped (trailing #) and the .tm has been manually tarred. if {[file exists $current_source_dir/#tarjar-$basename-${magicversion}#]} { diff --git a/src/modules/punk/ns-999999.0a1.0.tm b/src/modules/punk/ns-999999.0a1.0.tm index eb808ad2..945737cc 100644 --- a/src/modules/punk/ns-999999.0a1.0.tm +++ b/src/modules/punk/ns-999999.0a1.0.tm @@ -73,7 +73,7 @@ tcl::namespace::eval punk::ns { set out [nslist -types $types -nspathcommands $nspathcommands [nsjoin $ns_current *]] } else { set is_absolute [string match ::* $ns_or_glob] - set has_globchars [regexp {[*?]} $ns_or_glob] + set has_globchars [regexp {[*?]} $ns_or_glob] ;#basic globs only? if {$is_absolute} { if {!$has_globchars} { if {![nsexists $ns_or_glob]} { @@ -747,7 +747,13 @@ tcl::namespace::eval punk::ns { return $nslist } - variable usageinfo_char \U1f6c8 + #The information symbol - usually i in a circle + #punkargs " symbol \U1f6c8" ;#problematic on terminals that lie about cursor position after emitting this character + #The older \u2139 could be used - but it is sometimes a boxed i, sometimes a bold stylized i, sometimes a pre-coloured boxed i + #\u24d8 (circled latein small letter i) seems more consistent and can have our own colour applied. + #variable usageinfo_char \U1f6c8 + variable usageinfo_char \u24d8 + # command has usageinfo e.g from punk::args. todo cmdline, argp, tepam etc? proc Usageinfo_mark {{ansicodes \UFFEF}} { variable usageinfo_char @@ -760,6 +766,7 @@ tcl::namespace::eval punk::ns { } } + punk::args::define { @id -id ::punk::ns::Cmark @cmd -name punk::ns::Cmark @@ -768,7 +775,7 @@ tcl::namespace::eval punk::ns { oo " symbol \u25c6" ooc " symbol \u25c7" ooo " symbol \u25c8" - punkargs " symbol \U1f6c8" + punkargs " symbol \u24d8" ensemble " symbol \u24ba" native " symbol \u24c3" unknown " symbol \u2370" @@ -797,7 +804,7 @@ tcl::namespace::eval punk::ns { return; #should be unreachable - parse should raise usage error } } - set marks [dict create oo \u25c6 ooc \u25c7 ooo \u25c8 punkargs \U1f6c8 ensemble \u24ba native \u24c3 unknown \U2370] + set marks [dict create oo \u25c6 ooc \u25c7 ooo \u25c8 punkargs \u24d8 ensemble \u24ba native \u24c3 unknown \U2370] if {[llength $ansinames]} { return "[punk::ansi::a+ {*}$ansinames][dict get $marks $type]\x1b\[0m" } else { diff --git a/src/modules/punk/repl-999999.0a1.0.tm b/src/modules/punk/repl-999999.0a1.0.tm index 2ccca79d..4722eba8 100644 --- a/src/modules/punk/repl-999999.0a1.0.tm +++ b/src/modules/punk/repl-999999.0a1.0.tm @@ -1876,7 +1876,9 @@ proc repl::repl_process_data {inputchan chunktype chunk stdinlines prompt_config #ctrl-c if {$chunk eq "\x03"} { #::punk::repl::handler_console_control "ctrl-c_via_rawloop" - error "character 03 -> ctrl-c" + puts stderr "ctrl-c via rawloop - not signal" + ::punk::repl::handler_console_control ctrl-c via_rawloop + #error "character 03 -> ctrl-c" } if {$chunk eq "\x7f"} { @@ -1898,8 +1900,9 @@ proc repl::repl_process_data {inputchan chunktype chunk stdinlines prompt_config #for now - exit with small delay for tidyup #ctrl-z #::punk::repl::handler_console_control "ctrl-z_via_rawloop" - if {[catch {mode line}]} { - interp eval code {mode line} + if {[catch {punk::console::mode line}]} { + #REVIEW + interp eval code {punk::console::mode line} } after 1000 {exit 43} return diff --git a/src/modules/punk/repo-999999.0a1.0.tm b/src/modules/punk/repo-999999.0a1.0.tm index 2fb9a42b..727b563d 100644 --- a/src/modules/punk/repo-999999.0a1.0.tm +++ b/src/modules/punk/repo-999999.0a1.0.tm @@ -92,6 +92,9 @@ namespace eval punk::repo { } lappend maincommands {*}$ln } + #fossil output was ordered in columns, but we loaded list in row-wise, messing up the order + set maincommands [lsort $maincommands] + set allcmds [lsort $allcmds] set othercmds [punk::lib::ldiff $allcmds $maincommands] set result "@leaders -min 0\n" diff --git a/src/modules/shellrun-0.1.1.tm b/src/modules/shellrun-0.1.1.tm index 8f03892d..478c70fa 100644 --- a/src/modules/shellrun-0.1.1.tm +++ b/src/modules/shellrun-0.1.1.tm @@ -222,6 +222,9 @@ namespace eval shellrun { } set resolved_cmdname [auto_execok $cmdname] + if {$resolved_cmdname eq ""} { + error "Cannot find path for executable '$cmdname'" + } set repl_runid [punk::get_repl_runid] #set ::punk::last_run_display [list] diff --git a/src/modules/test/punk/#modpod-ansi-999999.0a1.0/ansi-0.1.1_testsuites/ansi/ansimerge.test b/src/modules/test/punk/#modpod-ansi-999999.0a1.0/ansi-0.1.1_testsuites/ansi/ansimerge.test new file mode 100644 index 00000000..caa2e54c --- /dev/null +++ b/src/modules/test/punk/#modpod-ansi-999999.0a1.0/ansi-0.1.1_testsuites/ansi/ansimerge.test @@ -0,0 +1,59 @@ + +package require tcltest + +namespace eval ::testspace { + namespace import ::tcltest::* + variable common { + set result "" + } + + test merge_basic_foreground {check that later foreground colour is the only one in the output}\ + -setup $common -body { + set c1 [punk::ansi::a+ red] + set c2 [punk::ansi::a+ green] + + set merged [punk::ansi::codetype::sgr_merge_singles [list $c1 $c2]] + lappend result [string equal $merged $c2] + + set merged [punk::ansi::codetype::sgr_merge_singles [list $c2 $c1]] + lappend result [string equal $merged $c1] + + }\ + -cleanup { + }\ + -result [list\ + 1 1 + ] + + + + test merge_nounderline_underline {nounderline }\ + -setup $common -body { + set no_u [punk::ansi::a+ nounderline] ;#\x1b\[24m\x1b\[4:0m (nounderline not a single because these can't be completely merged) + set u [punk::ansi::a+ underline] + set merged [punk::ansi::codetype::sgr_merge [list $no_u $u]] + + lappend result [string equal $merged $u] + + }\ + -cleanup { + }\ + -result [list\ + 1 + ] + + test merge_underline_nounderline {nounderline }\ + -setup $common -body { + set no_u [punk::ansi::a+ nounderline] ;#\x1b\[24m\x1b\[4:0m (nounderline not a single because these can't be completely merged) + set u [punk::ansi::a+ underline] + set merged [punk::ansi::codetype::sgr_merge [list $u $no_u]] + + lappend result [string equal $merged $no_u] + }\ + -cleanup { + }\ + -result [list\ + 1 + ] + +} \ No newline at end of file diff --git a/src/modules/test/punk/#modpod-ansi-999999.0a1.0/ansi-0.1.1_testsuites/tests/ansimerge.test#..+ansi+ansimerge.test.fauxlink b/src/modules/test/punk/#modpod-ansi-999999.0a1.0/ansi-0.1.1_testsuites/tests/ansimerge.test#..+ansi+ansimerge.test.fauxlink new file mode 100644 index 00000000..e69de29b