Browse Source

make pipeswitch accept args, fix ../ console display

master
Julian Noble 2 years ago
parent
commit
07fee92f4b
  1. 14
      src/modules/punk-0.1.tm

14
src/modules/punk-0.1.tm

@ -1481,6 +1481,14 @@ namespace eval punk {
} }
set cmdline_result [uplevel 1 [concat $rhs $segment_members_filled]] set cmdline_result [uplevel 1 [concat $rhs $segment_members_filled]]
set d [_multi_bind_result $returnvarspec [punk::K $cmdline_result [unset cmdline_result]]] set d [_multi_bind_result $returnvarspec [punk::K $cmdline_result [unset cmdline_result]]]
#multi_bind_result needs to return a funcl for rhs of:
#lindex [list [set syncvar [main pipeline.. ]] [rhs binding funcl...] 1 ]
#which uses syncvar
#
#The lhs of 'list' runs first so now syncvar can be the root level of the rhs function list and bind the necessary vars.
#NOTE: unintuitively, we are returning the value of rhs to the main pipleline! (leftmost binding) this is because the leftmost binding determines what goes back to the pipeline result
set r [_handle_bind_result $d] set r [_handle_bind_result $d]
set segment_result $r set segment_result $r
} }
@ -1829,7 +1837,9 @@ namespace eval punk {
} }
proc pipeswitch {pipescript} { proc pipeswitch {pipescript args} {
set prefix "set args \[list $args\]\n"
set pipescript $prefix$pipescript
uplevel 1 [list if 1 $pipescript] uplevel 1 [list if 1 $pipescript]
} }
proc ansi+ {args} { proc ansi+ {args} {
@ -2185,7 +2195,7 @@ namespace eval punk {
lappend chunklist [list result $result] lappend chunklist [list result $result]
set ::punk::last_run_display $chunklist set ::punk::last_run_display $chunklist
if {$::repl::running} { if {$::repl::running} {
repl::term::term::set_console_title $result repl::term::set_console_title $result
} }
return $result return $result
} }

Loading…
Cancel
Save