It turns out that tclreadline
's built-in completion handler executes script-defined procs to search for sub- or ensemble commands. However, in presence of the catch-all args
, this will simply execute the proc during this "completion" attempt:
Watch:
tclsh8.6 [/tmp] proc test {a b c} {puts "www"}
tclsh8.6 [/tmp] test[TAB]
<a>
tclsh8.6 [/tmp] proc test {args} {puts "www"}
tclsh8.6 [/tmp] test[TAB] www
www
For now, avoid procs with only "args" in their formal parameter spec. You might want to file a ticket . The "args" case should be handled properly. (My gut feeling is that the completion service should only use "info" introspection for procs, without exploring for sub- or ensemble commands, with execution only necessary for commands like cget, configure etc.)