Like 'team', 'team-slave' also understands the property 'config'.
Add it to bash completion for the 'connection add' command.
Signed-off-by: Thomas Haller <thaller@redhat.com>
If the curser is not at the end of the line, we want to complete
by ignoring everything right of the curser. However, the variable
$cur is set to the spaces since the last word, so we have to
get rid of them first
Without this, the following did not complete:
$ nmcli connection modify id <TAB> lo
because $cur is set to ' '.
Signed-off-by: Thomas Haller <thaller@redhat.com>
_init_completion returns the '${words[@]}' array with all the
quotes and escapes. We dont care about it so we drop (unescape)
first.
Before, the following failed:
nmcli 'c' <TAB>
nmcli connection modify id Wireless\ Connection\ 1 <TAB>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Only complete the setting name if it is at the very first
position after the connection.
e.g. complete the settings name in the case
$ nmcli connection modify em1 connec<TAB>
but not at
$ nmcli connection modify em1 connection.autoconnect <TAB>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This fixes an error in the following example:
$ nmcli con add type bridge con-name test-bridge <TAB>
Before, general options such as 'autoconnect' and 'ifname' were
wrongly not suggested.
Signed-off-by: Thomas Haller <thaller@redhat.com>
- the ifname argument for "connection add" is not mandatory
- support the long names for connection types ("802-*")
Signed-off-by: Thomas Haller <thaller@redhat.com>
Bash completion does now parse the command line from left to right and
only suggests options that make sense at the current cursor position.
If the cursor is not at the end of the line, the words right from the
cursor are ignored for completion. The reason is, that it would be much
more difficult to figure out the valid options when also looking at
options right from the cursor. However, it should still work nicely
even in this case.
There is still an unsolved issue when completing words with space or
other special characters. However, this issue was present before.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Before, whereever a connection id is accepted, the completion only
offered 'id', 'uuid', 'path', etc. With this change, it will additionally
suggest the id of existing connections.
https://bugzilla.redhat.com/show_bug.cgi?id=997997
Signed-off-by: Thomas Haller <thaller@redhat.com>
To support optimal completion, more context must be considered.
Especially the OPTIONS, which must appear before the OBJECT.
Modify bash completion to try parsing first the options.
Before, whenever you had options, completion did not work
anymore (because the object was expected as first argument).
Moreover, options were also suggested after specifying the
object. This is now mitigated by parsing the command line
in two steps.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Also sub commands can be abbreviated. Add some more aliases to the bash
completion.
Also fix the option 'nmcli radio mobile' which is called 'wwan'.
Signed-off-by: Thomas Haller <thaller@redhat.com>
nmcli accepts abbreviated versions of object names, e.g. 'con'
instead of 'connection'. Adjust bash completion to also support
this.
Signed-off-by: Thomas Haller <thaller@redhat.com>