Commit Graph

50 Commits

Author SHA1 Message Date
Thomas Haller
90ff0786cc cli/bash-completion: fix nmcli connection CMD completion for --help option
The --help option (or its aliases -help/help) is only allowed at as
first argument. Fix completion to account for this.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-02 17:55:14 +01:00
Thomas Haller
74b3c22e2f cli/bash-completion: only allow --help as first argument for nmcli connection modify
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-01 02:07:53 +01:00
Thomas Haller
9d7a1d4253 cli/bash-completion: use printf instead of echo (because echo inteprets some --options)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-01 02:07:53 +01:00
Thomas Haller
39dc39ec0a cli/bash-completion: simplify code by passing arrays by indirection to functions
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-01 02:07:53 +01:00
Thomas Haller
62cf1d85ff cli/bash-completion: complete more then one connections for nmcli connection delete
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
4196cc1179 cli/bash-completion: complete more then one properties for nmcli connection modify
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
280881f552 cli/bash-completion: complet nmcli connection modify --temporary
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
07cdf56a67 cli/bash-completion: support abbreviated options for commands
Add support for abbreviated options as first argument:

nmcli connection show --act <TAB>

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
7423bc4460 cli/bash-completion: support abbreviations for options
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-28 14:14:32 +01:00
Thomas Haller
c960d474fb cli/bash-completion: make 'ifname' a mandatory parameter for nmcli connection add
For some connection types (bond, bridge, team and vlan), 'ifname' is
optional.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-30 15:44:16 +01:00
Thomas Haller
6d25080e6a cli/bash-completion: complete 'save' option for nmcli connection add
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-30 10:49:51 +01:00
Thomas Haller
b5e2a45266 cli/bash-completion: update completion for new nmcli connection show syntax
As nmcli changes the syntax for the 'connection show' command,
this patch for bash completion also breaks several cases when
completing for an old nmcli command.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-23 13:46:46 +01:00
Thomas Haller
446516bcfa cli/bash-completion: trivial rename of functions
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:12:13 +01:00
Thomas Haller
e59be00d93 cli/bash-completion: add second level help option
Commands now support help at the second level. Add completion for it.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:12:13 +01:00
Thomas Haller
b4d9958b76 cli/bash-completion: only complete active connections for nmcli con down
Only complete the ids/uuids for active connections in
`nmcli connection down <type> <TAB>`.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:12:13 +01:00
Thomas Haller
8c659b79ed cli/bash-completion: cleanup/refactor by making functions generic
Instead of having several bash functions that return some values
via nmcli, add few functions that accept parameters.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:12:13 +01:00
Thomas Haller
aa931ab1f2 cli/bash-completion: fix wrong completion for nmcli device wimax
wimax does not support these arguments. This was a copy&paste error from wifi.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:11:43 +01:00
Thomas Haller
630a1ccbce cli/bash-completion: remove not yet implemented device type 'adsl'
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 11:10:03 +01:00
Thomas Haller
7fa79fcc5e cli: add pppoe type to nmcli bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-18 16:50:59 +01:00
Jiří Klimeš
bec69e175c cli: fix bash-completion for nmcli connection load (rh #1036545)
https://bugzilla.redhat.com/show_bug.cgi?id=1036545
2013-12-17 13:23:38 +01:00
Thomas Haller
7698d5dfc0 cli: bash completion completes filenames for team "config" property
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-22 14:10:34 +01:00
Thomas Haller
32b67cd1be cli: bash completion must not suggest IP options for adding slave types
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-18 16:38:07 +01:00
Thomas Haller
df7406fcf2 cli: add 'config' option to bash completion when adding team-slave connection
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>
2013-11-18 12:12:20 +01:00
Thomas Haller
6241366f30 cli: adjust bash completion for nmcli connection load <file>...
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-15 13:39:42 -05:00
Thomas Haller
bbddc0e18a cli: fix bash completion for curser not at EOL (2)
Previous commit had an error in the following case:
  $ nmcli connection modify  '  <TAB>     id

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:02:23 +01:00
Thomas Haller
93f5687d7b cli: fix bash completion for curser not at EOL
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>
2013-11-13 14:42:59 +01:00
Thomas Haller
ce370fab64 cli: add bash-completion for 'nmcli general hostname'
https://bugzilla.redhat.com/show_bug.cgi?id=1018510
2013-11-13 12:19:51 +01:00
Thomas Haller
ed60815d4c cli: improve handling of quoting in bash completion
_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>
2013-11-12 18:49:03 +01:00
Thomas Haller
6107a94099 cli: improve bash completion to complete -h and --help aliases
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-11 15:27:45 +01:00
Dan Williams
7d57386e04 cli: add support for 'nmcli dev connect ifname XXX' 2013-10-31 15:45:21 -05:00
Dan Williams
42c7ea85a1 cli: add support for 'nmcli con up ifname XXX'
Passes a NULL connection to nm_client_activate_connection() allowing
NetworkManager to pick the best available connection for the interface.
2013-10-31 15:45:20 -05:00
Thomas Haller
623f8a2be1 cli: fix bash completion for nmcli connection modify
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>
2013-10-30 13:33:47 +01:00
Thomas Haller
2a7c976539 cli: show property names in bash completion for nmcli connection modify
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-24 14:52:08 +02:00
Thomas Haller
78a8df37d8 cli: fix bash completion to show general options
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>
2013-10-03 16:05:44 +02:00
Thomas Haller
f37686fba7 cli: add primary bonding option in bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 14:19:12 +02:00
Thomas Haller
ed08a3fe04 cli: fix missing type option 'team' in mcli completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-30 19:07:18 +02:00
Thomas Haller
8548d68381 nmcli: extend bash completion for 'nmcli networking connectivity'
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-12 16:19:42 +02:00
Thomas Haller
7ad5c79441 nmcli: minor fixes in bash completion
- 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>
2013-09-06 17:47:57 +02:00
Thomas Haller
fc7468131c nmcli: major rework of bash completion
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>
2013-09-05 10:47:41 +02:00
Thomas Haller
2d2b2a48eb cli: change completion to suggest connection ids
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>
2013-08-28 14:36:49 +02:00
Thomas Haller
ab231cb0d9 cli: improve bash completion by parsing options separately.
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>
2013-08-28 14:36:49 +02:00
Thomas Haller
e2f77d30b1 cli: make bash-completion for nmcli support more abbreviations.
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>
2013-08-13 14:17:44 +02:00
Thomas Haller
faa6a12ba3 cli: make bash-completion support abbreviated object names.
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>
2013-08-12 13:33:13 -05:00
Jiří Klimeš
34ab351284 cli: update bash-completion file for 'connection modify' 2013-07-22 13:37:17 +02:00
Jiří Klimeš
ead6d31eac cli: update bash-completion file for 'connection edit' 2013-07-22 13:37:16 +02:00
Jiří Klimeš
790b3a753c cli: update bash completion file - 'nmcli connection reload' 2013-06-18 15:45:16 +02:00
Jiří Klimeš
2b843dac50 cli: change '--private' to 'private yes|no' in 'nmcli dev wifi connect'
Missing 'private' argument default to private=no, the same way as before.
2013-05-16 10:28:40 +02:00
Jiří Klimeš
24f05292da cli: update bash-completion file for 'connection add'
* _nmcli_list vs. _nmcli_list_nl - space vs. new-line separated list
* connection add
  - various types, modes, mac, ifname, ...
2013-05-07 19:41:37 +02:00
Jiří Klimeš
654a79ba88 cli: update bash completion file for the new syntax 2013-04-09 10:31:13 +02:00
Michael Biebl
1556a19c3e Add bash-completion file for nmcli
Based on work by Guillaume Rousse <guillomovitch@gmail.com>
2013-02-19 21:20:59 +01:00