[IPython-user] Hierarchical TAB completion?

Ville M. Vainio vivainio@gmail....
Tue Apr 3 13:57:12 CDT 2007


On 4/3/07, Pierre Bielmann <pierre.bielmann@gmail.com> wrote:

> Hi all,
>
> Is it possible to implement (with iPython) a shell which behaves like a
> classical
> Router Command Line Shell (e.g. Cisco IOS shell, etc.)? I'd like to "enter"
> objects in a hierachical
> fashion and execute commands/methods and also have command line completion
> only in that context
> (and not globally). Here is a simple example of what I have in mind:

http://ipython.scipy.org/moin/Cookbook/CustomCompleters

Perhaps you could hook a completer method of your state-aware object
as a re_key = '.*' (match all), so it would be "tried" for every
command line. It would just see that it's currently in state 'user',
and return appropriate completions.

I.e. you have only one completer function, which just behaves
differently depending on the state. Granted that it's not the most
elegant solution.

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'


More information about the IPython-user mailing list