[Patches] [ python-Patches-416224 ] add readline completion to cmd.Cmd

noreply@sourceforge.net noreply@sourceforge.net
Sat, 14 Apr 2001 23:06:28 -0700


Patches item #416224, was updated on 2001-04-14 20:52
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=416224&group_id=5470

Category: library
Group: None
Status: Open
Priority: 5
Submitted By: Matthew Mueller (donut)
Assigned to: Nobody/Anonymous (nobody)
Summary: add readline completion to cmd.Cmd

Initial Comment:
Adds command completion to Cmd class.  Can be disabled
by calling __init__ with completekey=None or can use a
different key, it defaults to 'tab'.

Not sure if this is really the best way to
enable/disable it, but it works. (oh, prolly requires
doc updates too)

Would also be nifty to provide command-specific
completion with something like
complete_<commandname>(...) funcs, but this is not
possible with python's current readline interface. (doh)

----------------------------------------------------------------------

>Comment By: Matthew Mueller (donut)
Date: 2001-04-14 23:06

Message:
Logged In: YES 
user_id=65253

Ok, heres a new patch that implements command specific
completion as well.  It is diffed against a clean cmd.py,
not the previous patch.

I also have a patch against pstats.py to make its
interactive mode take advantage of this, should I submit it
in a seperate report?

----------------------------------------------------------------------

Comment By: Matthew Mueller (donut)
Date: 2001-04-14 21:27

Message:
Logged In: YES 
user_id=65253

Hm, actually I just looked into the readline module a bit
deeper and it looks like it is possible after, all I was
going only on what was passed to the complete func but with
the get_line_buffer and friends it should be possible.. so,
I'll see if I can work up a patch that includes command
specific completion.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=416224&group_id=5470