[Xorp-hackers] XORPSH: command space auto-completion

Ray Qiu ray.qiu@gmail.com
Mon, 26 Jul 2004 00:02:08 -0700


Hi Pavlin,

Thanks.  Actually after I sent you guys the mail, I found out that my
solution was wrong, because it prevent me from typing "show pim xxx",
since pim and pim6 both are there in
the sub command list.  Sorry about that.

I will try out your fix.  Appreciated.

BTW, is anyone currently working on IS-IS?

--Ray

 

On Sun, 25 Jul 2004 20:52:47 -0700, Pavlin Radoslavov <pavlin@icir.org> wrote:
> 
> 
> > Hi there,
> >
> > I like this project and you guys have done an awesome job.  Thanks!
> >
> > It seems that currently the command space auto-completion only works for
> > the first command, because the code looks like this:
> >
> > cli/cli_node_net.cc:
> >
> > if (token.empty() || (multi_command_find(command_line) != NULL)){
> >   unbind space to complete-word
> >  ...
> > }
> >
> > It is not handy, because we have to use tab.
> >
> > It seems to work better in the following:
> >
> > // check the last character to see if it is a space, if so unbind
> > space to complete-word.
> > if (token.empty() || (command_line[command_line.length() - 1] == ' ')) {
> >   unbind space to complete-word
> >    ..
> > }
> >
> > Now space auto-cpmpletion works for sub commands as well.
> >
> > Any thoughts?
> 
> Ray,
> 
> You are right. Currently, the <SPACE> auto-completion doesn't work
> for sub-commands. The above solution fixes that, but it doesn't work
> for some corner cases. E.g., start the test-program cli/test_cli,
> then use "telnet localhost 12000" and try to enter command
> "myset foo", where "foo" is a free-style argument.
> The space auto-completion will prevent you from doing that.
> 
> I just commited a fix to the cli dorectory that should address the
> problem. The fix basically replaces method "multi_command_find()"
> that is used only in the above code with a new (more appropriate)
> method "is_multi_command_prefix()" that does the right thing.
> 
> Please let me know if the new code works for you or if you find some
> other problems.
> 
> Thanks,
> Pavlin
> 
>