On 4/3/07, <b class="gmail_sendername">Ville M. Vainio</b> <<a href="mailto:vivainio@gmail.com">vivainio@gmail.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 4/3/07, Pierre Bielmann <<a href="mailto:pierre.bielmann@gmail.com">pierre.bielmann@gmail.com</a>> wrote:<br><br>> Hi all,<br>><br>> Is it possible to implement (with iPython) a shell which behaves like a
<br>> classical<br>> Router Command Line Shell (e.g. Cisco IOS shell, etc.)? I'd like to "enter"<br>> objects in a hierachical<br>> fashion and execute commands/methods and also have command line completion
<br>> only in that context<br>> (and not globally). Here is a simple example of what I have in mind:<br><br><a href="http://ipython.scipy.org/moin/Cookbook/CustomCompleters">http://ipython.scipy.org/moin/Cookbook/CustomCompleters
</a><br><br>Perhaps you could hook a completer method of your state-aware object<br>as a re_key = '.*' (match all), so it would be "tried" for every<br>command line. It would just see that it's currently in state 'user',
<br>and return appropriate completions.<br><br>I.e. you have only one completer function, which just behaves<br>differently depending on the state. Granted that it's not the most<br>elegant solution.<br><br>--<br>Ville M. Vainio -
<a href="http://vivainio.googlepages.com">vivainio.googlepages.com</a><br>blog=<a href="http://360.yahoo.com/villevainio">360.yahoo.com/villevainio</a> - g[mail | talk]='vivainio'<br></blockquote></div><br><br clear="all">
Hi,<br>thanks for the input. I was thinking along the same line but hoping for some other idea. :-)<br>I'll take a look at it and see if this works out.<br><br>Pierre<br><br>-- <br>Pierre Bielmann <<a href="mailto:pierre.bielmann@gmail.com">
pierre.bielmann@gmail.com</a>>