Commit Graph

57 Commits

Author SHA1 Message Date
Jiří Klimeš
c7a567ca90 cli: add 'nmcli device delete <ifname>' command (rh #1034150)
It only works for software devices. When called for a hardware device,
an error is returned and the device is not deleted.

https://bugzilla.redhat.com/show_bug.cgi?id=1034150
2014-07-22 14:24:43 +02:00
Swapnil Nagarkar
2e3523bb43 nmcli autocomplete tab display : rename ERROR to ERR
The nmcli auto completation shows log levels as ERROR.
But giving ERROR it does not work. This should renamed
from ERROR to ERR

https://mail.gnome.org/archives/networkmanager-list/2014-June/msg00019.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-12 14:29:13 +02:00
Jiří Klimeš
e88979a354 cli: add optional 'mac' argument for 'nmcli con add type bridge'
This allows setting bridge MAC either on command-line
nmcli con add type bridge con-name mybridge mac 11:22:33:44:55:66
or provide it when asked
nmcli -a con add type bridge con-name mybridge
2014-05-30 17:02:31 +02:00
Jiří Klimeš
d7216505bb cli: do not restrict VPN type of created connections (rh #1100750)
There may be third-party VPN plugins nmcli is not aware of.
We still print a warning if nmcli doesn't know the type. It helps to catch up
typos.

https://bugzilla.redhat.com/show_bug.cgi?id=1100750
2014-05-28 09:37:15 +02:00
Thomas Haller
3a19de80f7 nmcli/completion: fix logging domain "OLPC" for nmcli bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-12 19:00:00 +02:00
Thomas Haller
9305c5bbf7 man/cli: add missing log domains to manual page and nmcli bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-24 17:27:47 +02:00
Jiří Klimeš
b911d663d8 cli/bash-completion: escape spaces in profile names (rh #1041901) (bgo #709426)
We need to escape spaces and quotes in connection names, so that a connection
name containing spaces (quotes) is regarded as a single argument by bash.
See e.g. http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion

https://bugzilla.redhat.com/show_bug.cgi?id=1041901
https://bugzilla.gnome.org/show_bug.cgi?id=709426
2014-04-15 16:32:02 +02:00
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