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

noreply@sourceforge.net noreply@sourceforge.net
Sat, 28 Jul 2001 07:46:05 -0700


Patches item #416224, was opened at 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: Closed
>Resolution: Accepted
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: Martin v. Löwis (loewis)
Date: 2001-07-28 07:46

Message:
Logged In: YES 
user_id=21627

Thanks for your patch, this was committed as cmd.py 1.25.
I also fixed the pstats base class __init__ call, and 
added text to Misc/NEWS and libcmd.tex.


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

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

Message:
Logged In: YES 
user_id=65253

Oh, also note that if you try to test it with pstats you
have to at the very least make its __init__ call
Cmd.__init__, since it doesn't do that currently..

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

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