Note that there are some explanatory texts on larger screens.

plurals
  1. POtrigger tab completion for python batch process built around readline
    text
    copied!<p><strong>Background:</strong> I have a python program that imports and uses the readline module to build a homemade command line interface. I have a second python program (built around bottle, a web micro-framework) that acts as a front-end for that CLI. The second python program opens a pipe-like interface to the first, essentially passing user input and CLI output back and forth between the two.</p> <p><strong>Problem:</strong> In the outer wrapper program (the web interface), whenever the end-user presses the TAB key (or any other key that I bind the readline completer function), that key is inserted into the CLI's stdin <strong>without</strong> firing the readline completer function. I need this to trigger readline's command completion function instead, as normally occurs during an interactive CLI session.</p> <p><strong>Possible Solution #1:</strong> Is there some way to send the TAB key to a subprocess' stdin, so that a batch usage works the same as an interactive usage?</p> <p><strong>Possible Solution #2:</strong> Or, if there was some way to trigger the entire completion process manually (including matches <strong>generation</strong> and <strong>display</strong>), I could insert and scan for a special text sequence, like <code>"&lt;TAB_KEY_HERE&gt;"</code>, firing the possible completion matches <strong>display</strong> function manually. (I wrote the completer function, which generates the possible matches, so all I really need is access to readline's function to display the possible matches.)</p> <p><strong>Possible Solution #3:</strong> I guess, if I cannot access readline's matches-display function, the last option is to rewrite readline's built-in display-completion function, so I can call it directly. :(</p> <p>Is there a better solution? Any suggestions on following the paths presented by any of the above solutions? I am stuck on #1 and #2, and I'm trying to avoid #3.</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload