Hi Andy,
On Fri, 13 Nov 2015 15:11:17 -0800, Andy Grover wrote :
If you have time, I could use some help with Configshell's
parsing.
You're welcome.
We bracket iscsi ipv6 portals, so after creating one, it will show
up
in targetcli like
o- portals
o- [::]:3260
But, if I type "cd [<tab>" it doesn't autocomplete. I have traced
this down to pyparsing not thinking '[' is a path. I then tried to
fix this by adding \[\] to both parts of the pathstd Regex (shell.py
line 118) like so:
pathstd = Regex('([A-Za-z0-9:_.\[\]]|-)*' + '/' +
'([A-Za-z0-9:_./\[\]]|-)*') | '..' | '.'
but that didn't seem to work.
I reproduced the issue. The logic for parsing the command line and
suggesting completions is convoluted. The general form of a command is:
path command parameters
In your case, the path is empty, the command is "cd" and what you want
to complete is a positional parameter starting with "[". So we have to
add '[' to pparam, not pathstd. Moreover, we need to remove '[' and
']'
from the call to readline's set_completer_delims() so that it does not
remove these characters from the "text" argument in
_complete_token_pparam().
I will prepare a patch for that. I wonder if square brackets are used
for something else that could possibly get broken by the above changes.
With best regards,
--
Christophe Vu-Brugier