Browse Source

scriptlib/developer: piperepl manual probes (evalinput, showinput) - tclsh subcommand/patch drivers

Assisted-by: harness=opencode; primary-model=openrouter/moonshotai/kimi-k3; api-location=openrouter.ai
master
Julian Noble 7 days ago
parent
commit
aa6dfe753a
  1. 32
      scriptlib/developer/piperepl/evalinput.tcl
  2. 21
      scriptlib/developer/piperepl/showinput.tcl

32
scriptlib/developer/piperepl/evalinput.tcl

@ -0,0 +1,32 @@
set exebase [file rootname [file tail [info nameofexecutable]]]
puts stdout "------------------------"
puts stdout "message from script"
puts stdout "exebase : $exebase"
puts stdout "::tcl_interactive : $::tcl_interactive"
puts stdout "::tclsh(istty) : $::tclsh(istty)"
puts stdout "------------------------"
#optionally read part or all of stdin,
#but we don't know how to put data back into stdin - so partial read should only be done if there is a protocol for the data to be read and processed.
#set inputdata [read stdin]
if {"-noeval" ni $::argv} {
set ::tclsh(evalinput) 1
} else {
if {"-eat2" in $::argv} {
set eat [read stdin 2]
puts stdout "stdin read: [string length $eat] bytes"
puts stdout $eat
puts stdout "info exist ::tclsh(inputbuffer): [info exists ::tclsh(inputbuffer)]"
}
#set ::tclsh(evalinput) 0
}
#now that we have set the evalinput flag for PIPEREPL - when we exit this script - the piperepl will read from stdin and evaluate any remaining input as tcl code.
#This means that no matter what we do with ::tclsh(dorepl) - it could be overridden by the script on the input. that's ok.
if {"-dorepl" in $::argv} {
set ::tclsh(dorepl) 1
}

21
scriptlib/developer/piperepl/showinput.tcl

@ -0,0 +1,21 @@
set exebase [file rootname [file tail [info nameofexecutable]]]
puts stdout "------------------------"
puts stdout "message from script"
puts stdout "exebase : $exebase"
puts stdout "::tcl_interactive : $::tcl_interactive"
puts stdout "::tclsh(istty) : $::tclsh(istty)"
puts stdout "------------------------"
if {!$::tcl_interactive} {
set data [read stdin]
puts stdout "stdin read: [string length $data] bytes"
puts stdout $data
}
if {"-dorepl" in $::argv} {
set ::tclsh(dorepl) 1
set ::tcl_interactive 1
}
Loading…
Cancel
Save