[Xorp-hackers] XORPSH: command space auto-completion
Pavlin Radoslavov
pavlin@icir.org
Sun, 25 Jul 2004 20:52:47 -0700
> 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