cmd, readline, and /path/filename completion

Michael Hudson mwh at python.net
Wed Jul 24 07:16:28 EDT 2002


Dave Cinege <dcinege at psychosis.com> writes:

> Dunno much about programming readline, so maybe this is obvious.
> 
> I toying with a unix shell written in python using shlex and cmd.
> (For now based on the _Python 2.1 Bible_  lextocon example...)
> 
> It's actually quite functional at this point. (Though replacing
> bash with it, doesn't quite work yet... <grin>)
> 
> I'm trying to tweak the readline functionality, and am a bit lost.
> 
> In Bash
> 	cd /etc/<tab>
> Will display a list of files in /etc/ to complete against.
> 
> In my shell, I will always see the files in the current directory.
> 
> What must be done to mimic the bash functionaly? Is it an option that
> must be turned on in readline? Do I have to snag the line, and if it is a 
> valid path, cd to that path? (then back to PWD)

I'm guessing that you need to fiddle what characters readline thinks
are word boundaries.  readline.set_completer_delims looks hopeful.

Cheers,
M.

-- 
  Gullible editorial staff continues to post links to any and all
  articles that vaguely criticize Linux in any way.
         -- Reason #4 for quitting slashdot today, from
            http://www.cs.washington.edu/homes/klee/misc/slashdot.html



More information about the Python-list mailing list