Commit Graph

477 Commits

Author SHA1 Message Date
Jiří Klimeš
e44bb5e6fc cli: add 'help' for second level commands (bgo #698237) (rh #1034119)
In addition to 'nmcli connection help', you can now use:
nmcli con up help
nmcli con down help
nmcli dev wifi help
etc.

The help option can also be in the form of --help/-h, or even shortened.

https://bugzilla.gnome.org/show_bug.cgi?id=698237
https://bugzilla.redhat.com/show_bug.cgi?id=1034119
2014-01-09 10:14:03 +01:00
Thomas Haller
3051a908a9 cli: fix leaks for getter functions (release GValue)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-08 14:29:19 +01:00
Jiří Klimeš
3668fd7cbc cli: display MTU for devices 2013-12-20 11:37:54 +01:00
Jiří Klimeš
e3bd575758 cli: simplify getting device hardware addresses 2013-12-20 11:37:54 +01:00
Jiří Klimeš
f889440b96 cli: more compact format for device info (nmcli device show) (rh #998003)
https://bugzilla.redhat.com/show_bug.cgi?id=998003
2013-12-20 11:37:54 +01:00
Dan Winship
f1f4f32c02 cli: get IP/DHCP config directly from the NMActiveConnection (rh #1036132)
Now that NMActiveConnection has IP and DHCP config info, use that
directly in "nmcli con show active" rather than getting it from the
connection's device; this way, we get the right info for VPN
connections as well.
2013-12-19 11:49:50 -05: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š
107fdd6b01 cli: support PPPoE connection types in 'nmcli con add' 2013-12-18 16:45:59 +01:00
Jiří Klimeš
80851c3550 cli: consider empty value as "*" for "Interface name [*]: " prompt (rh #953397)
And, do it right this time.

https://bugzilla.redhat.com/show_bug.cgi?id=953397
2013-12-18 16:10:48 +01:00
Jiří Klimeš
340542a2f2 Revert "cli: consider empty value as "*" for "Interface name: " prompt"
This reverts commit 3cb0bf6bc0.
It broke 'ifname' being required as a mandatory parameter as decided in
https://bugzilla.gnome.org/show_bug.cgi?id=698113
2013-12-18 16:05:37 +01:00
Jiří Klimeš
d79b56a7e9 cli: 'id' option for 'nmcli con add type vlan' is mandatory (rh #953397)
So update documentation accordingly.

https://bugzilla.redhat.com/show_bug.cgi?id=953397
2013-12-18 15:49:10 +01:00
Jiří Klimeš
abaa17edb9 cli: fix compilation without WiMAX 2013-12-17 14:55:13 +01:00
Jiří Klimeš
4ef8696c77 cli: allow '--field group.field' for nmcli con show conf <bla>
That means you can display single property.

Example:
$ nmcli -f connection.id,802-3-ethernet.mtu s c my-eth-profile
connection.id:                          my-eth-profile
802-3-ethernet.mtu:                     auto
2013-12-17 13:52:11 +01:00
Jiří Klimeš
990f83b7d3 cli: allow '--field group.field' for nmcli con show active <bla>
Example:
$ nmcli -f general.name,ip4.address c s a myeth
GENERAL.NAME:                           myeth
IP4.ADDRESS[1]:                         ip = 10.34.25.228/23, gw = 10.34.25.254
2013-12-17 13:52:02 +01:00
Jiří Klimeš
94bb83a370 cli: allow specifying 'group.name' syntax for '--fields'
and use it for 'nmcli device show'.

This allows filtering output not only for whole groups, but also for individual
fields in commands that print data in groups (sections).

Example:
$ nmcli -f general.device,general.driver,ipv4,ipv6.address device show eth0
GENERAL.DEVICE:                         eth0
GENERAL.DRIVER:                         e1000e
IP4.ADDRESS[1]:                         ip = 10.0.5.228/23, gw = 10.0.5.254
IP4.ADDRESS[2]:                         ip = 5.5.5.5/32, gw = 5.5.5.1
IP4.DNS[1]:                             192.168.122.1
IP4.DNS[2]:                             8.8.8.8
IP4.DOMAIN[1]:                          mycompany.com
2013-12-17 13:51:34 +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
Jiří Klimeš
72922f2068 cli: fix description of connection parameters and specify some default values 2013-12-13 09:50:09 +01:00
Jiří Klimeš
df104771ae cli: support PPPoE connection type in nmcli connection editor 2013-12-11 16:54:17 +01:00
Jiří Klimeš
d40a499c01 cli: add active connections to 'nmcli device status' 2013-12-09 12:35:43 +01:00
Jiří Klimeš
62f07eea26 cli: fix nmcli help for connection object (rh #1036545)
https://bugzilla.redhat.com/show_bug.cgi?id=1036545
2013-12-02 15:40:11 +01:00
Jiří Klimeš
655af71c6d nmcli: fix connecting VLANs without an explicit interface-name (rh #1034908)
nm_connection_get_virtual_iface_name() doesn't work when determining virtual
connections, because for VLANs it can return NULL.

See also commit e1e4740648.

https://bugzilla.redhat.com/show_bug.cgi?id=1034908
2013-11-28 16:50:42 +01:00
Dan Williams
d35cb5b77c cli: add support for DCB settings 2013-11-27 10:05:43 -06:00
Dan Winship
461920bb96 cli: add NMC_RESULT_ERROR_NOT_FOUND and use as appropriate
This will allow callers to distinguish "no such connection" from
"connection failed to activate", etc.

https://bugzilla.redhat.com/show_bug.cgi?id=1022256
2013-11-22 13:51:25 -05:00
Jiří Klimeš
472ee8104d cli: initialize interface-name for new team connections in editor 2013-11-22 14:28:08 +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
Jiří Klimeš
cdec23d314 cli: complete file names for properties whose value is a file name
Note:
Tilde expansion is enabled, so ~/abc<TAB> expands the string to /home/joe/abc.
However, when user did not use the completion and typed "~/myfile" manually,
the path could not be opened.

nmcli 802-1x.ca-cert> set ~/newca.crt
Error: failed to set 'ca-cert' property: Failed to open file '~/newca.crt': No such file or directory
2013-11-22 14:09:10 +01:00
Jiří Klimeš
a3c06afc12 cli: support file names for 'config' argument when creating team connections
nmcli con add type team config /home/cimrman/team-config.json

libteam (and in turn NetworkManager) configures team devices via plain config
data in JSON format. However, it is useful and more user-friendly for nmcli to
accept also a file name that contains the config data, and read it. Thus the
user is not forced to type whole (possibly long) config on the command line.
2013-11-22 14:09:10 +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
Jiří Klimeš
160d6f073e cli: add missing reason-to-string mappings for NMDeviceStateReason 2013-11-18 16:17:23 +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
Dan Winship
9a532db182 cli: add "nmcli con load file..."
https://bugzilla.gnome.org/show_bug.cgi?id=709830
2013-11-15 13:39:40 -05:00
Jiří Klimeš
2a2af5825a cli: allow editing 'generic' connections 2013-11-14 13:53:44 +01:00
Jiří Klimeš
dbba05a3db cli: fix crash on editing 'lo' connection (rh #1030395)
https://bugzilla.redhat.com/show_bug.cgi?id=1030395
2013-11-14 13:53:21 +01:00
Thomas Haller
97935382f4 coverity: fix various warnings detected with Coverity
These are (most likely) only warnings and not severe bugs.
Some of these changes are mostly made to get a clean run of
Coverity without any warnings.

Error found by running Coverity scan

https://bugzilla.redhat.com/show_bug.cgi?id=1025894

Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:29:24 +01:00
Thomas Haller
ab92a0d69c cli: fix reading IP config for *-slaves
Error found by running Coverity

https://bugzilla.redhat.com/show_bug.cgi?id=1025894

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:29:24 +01:00
Thomas Haller
0139ad37f7 cli: fix potential crash in nmcli when using strcmp
Error found by running Coverity

https://bugzilla.redhat.com/show_bug.cgi?id=1025894

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:29:24 +01: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
Jiří Klimeš
79ac1cf089 cli: add support for getting/setting hostname to nmcli (rh #1018510)
https://bugzilla.redhat.com/show_bug.cgi?id=1018510
2013-11-13 12:19:51 +01:00
Thomas Haller
d95da820fc cli: tivial fixup whitespace in command description text
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-12 20:45:05 +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
Thomas Haller
c9cfbae12b cli: make command line parsing check for help option first
Move the checks for nmc_arg_is_help to the beginning of the
checks for command matches.

Up to now, no command begins with 'h', so this has no behavioral
change whatsoever. But imagine a command that begins with 'h'
(for example `nmcli general hostname`), in that case `nmcli general h`
should still show the help, as users might be accustomed to this
abbreviation.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-11 15:27:45 +01:00
Thomas Haller
93131b1df2 cli: fix in matching command line arguments
Ensure in matches() that a non-empty cmd is given, otherwise
as currently

  nmcli general -

matches to '-h' and is thus treated as

  nmcli general -h

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-11 15:27:30 +01:00
Jiří Klimeš
5a4e40bacf cli: fix 'nmcli con up bad_name' or 'nmcli con up'
** (process:25157): CRITICAL **: nmc_activate_connection: assertion `NM_IS_CONNECTION (connection) || ifname' failed
Error: unknown error.

Regression caused by 42c7ea85a1.
2013-11-07 18:01:16 +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
Jiří Klimeš
375220cae1 cli: TAB-complete devices for 'activate' command in the editor 2013-10-31 09:00:56 +01:00