Commit Graph

59 Commits

Author SHA1 Message Date
Lubomir Rintel
9d2290135c cli: make nmcli do its own command completion
https://bugzilla.gnome.org/show_bug.cgi?id=777328
2017-02-13 16:32:15 +01:00
Beniamino Galvani
108f04e71e cli: completion: escape shell special characters "()&!"
https://bugzilla.gnome.org/show_bug.cgi?id=772629
2016-10-26 13:41:00 +02:00
Lubomir Rintel
8b4494598d cli/device: add modify command
It modifies the applied connection using the Reapply API.
2016-06-29 20:28:42 +02:00
Francesco Giudici
fdecb6b669 cli: option autocompletion should not match words without trailing '-'
This would fix for example:
nmcli e <TAB>
(e interpreted as --escape, would allow autocompletion to work... but
when the command is executed an error is reported)

Moreover, we will now have:
nmcli c <TAB>
autocompletion work correctly, i.e., c is correctly interpreted  as
"connection" instead of "--colors"
2016-06-28 12:12:39 +02:00
Beniamino Galvani
4c7f609d51 cli: autocompletion: add missing log level and domains
Add KEEP level and DHCP, IP, AUDIT, SYSTEMD, VPN_PLUGIN domains.
2016-06-27 11:40:39 +02:00
Francesco Giudici
ea9dcd08fa nmcli: manage autocompletion of "nmcli connection add" when no args are passed
This enables back "help" "--help" "-help" in autocompletion.
2016-06-23 17:35:08 +02:00
Lubomir Rintel
8b39090597 cli: use --complete-args for connection add completion
And make it incredibly slow at the same time.
2016-06-21 18:40:22 +02:00
Lubomir Rintel
3aff650e22 nmcli: improve connection autocompletion (2/2)
Complete the property as we parse the list of properties. This makes it
possible to actually complete an unfinished property.  E.g:

  $ nmcli --complete c modify enp0s25 +ipv6.addr
  +ipv6.addresses +ipv6.addr-gen-mode
2016-06-21 16:28:48 +02:00
Francesco Giudici
cd4395a261 nmcli: enable connection autocompletion for 802.1x properties
nmcli bash autocompletion leveraged on "nmcli connection edit", "print"
to retrieve the specific properties of a connection. Anyway, the
interactive editor is smart and just prints the used components, so in a
connection where 802.1x is not enabled we had no autocompletion.
Solved adding an "hidden" command "nmcli --complete connection modify"
as suggested in bgo #724860 in order to retrieve ALL the available
properties for use in autocompletion.
Here patch from L.Rintel has been merged to make che --complete option
global to nmcli (first version was local to "connection modify").

https://bugzilla.gnome.org/show_bug.cgi?id=724860
https://bugzilla.redhat.com/show_bug.cgi?id=1301226
2016-06-21 16:28:48 +02:00
Francesco Giudici
fbaaf51f52 nmcli autocompletion cleanups
* no need to check HELP_ONLY_AS_FIRST var as when --help option is passed
  _nmcli_compl_OPTIONS will return 0, falling in the general case that
  will trigger end of autocompletion

* clanup local var declaration in _nmcli func:
  - remove dupliated OPTIONS_MANDATORY declaration
  - init HELP_ONLY_AS_FIRST on declaration
  - order vars for common prefix
2016-06-21 16:28:39 +02:00
Thomas Haller
09a015b23b nmcli-completion: complete filename for VPN import and passwd-file
Also hard-code the VPN types strongswan and fortisslvpn.

https://bugzilla.redhat.com/show_bug.cgi?id=1337300
2016-05-19 12:52:59 +02:00
Thomas Haller
d742ea7817 cli: don't allow multiple <ifname> arguments to device-reapply
Just like `nmcli device connect` only allows one argument, don't allow
multiple device arguments for reapply.

Allowing multiple device names makes it more complicated to add
additional options to the command. For example, it would be useful
to have a

    nmcli device reapply eth0 connection id other-connection

but when allowing multiple device names, it gets more complicated in
documentation, command line parsing and bash completion.

Note that the user can achieve a very similar outcome by using the
shell:

    for DEV in eth0 eth1 eth2; do
        nmcli device reapply $DEV &
    done
    wait

argubaly, this doesn't report the exit status properly. To properly
handle that would require more effort. Also, it is somewhat less
efficient, but well.

This is an API change, however it is very new API that probably nobody
is using much. Also, the documentation (man nmcli) didn't mention the
possibility to pass multiple device names.
2016-05-03 11:52:57 +02:00
Francesco Giudici
3c67a1ec5e cli: remove version check against NM
When performing NM package upgrade the new version of nmcli will be immediately
available while NM daemon will not, as it would not restart in order to avoid
to disrupt connectivity. This could create issues with tools leveraging
on nmcli output (till reboot). As apart from this case it is very unlikely
that a user can have this nmcli / NM daemon version mismatch situation,
the check could cause more harm than benefit in real user case
scenarios.

https://bugzilla.redhat.com/show_bug.cgi?id=1291785
2016-04-28 09:35:20 +02:00
Beniamino Galvani
f0c6a0315d cli: prefer 'modify' over 'monitor' when the command is abbreviated
In previous releases 'nmcli connection m' was interpreted as 'modify',
but recently the monitor command was introduced with a higher
priority, changing the behavior when the abbreviated form is
used.

Restore the old behavior.

https://bugzilla.redhat.com/show_bug.cgi?id=1316120
2016-03-10 11:12:02 +01:00
Lubomir Rintel
fa6375cd8b cli: add nmcli d reapply
Client support for O.FD.NM.Device.Reapply().
2016-01-10 23:13:34 +01:00
Jiří Klimeš
73dcc3310c cli: (bash completion): add new settings to completion of '--fields' 2015-12-17 16:42:54 +01:00
Jiří Klimeš
6391a20114 cli: add bash completion for arguments of tun, ip-tunnel, macvlan, vxlan
for 'nmcli connection add type ...'
2015-12-17 16:28:42 +01:00
Beniamino Galvani
7da440b798 cli: add vxlan support 2015-12-09 16:36:46 +01:00
Beniamino Galvani
c3e6e25239 cli: add macvlan support 2015-12-09 14:30:08 +01:00
Jiří Klimeš
629de4e689 cli: add global --show-secrets option
- it controls echoing passwords input on terminal
- it replaces --show-secrets in 'nmcli connection show', which is deprecated now
- it replaces --show-password in 'nmcli device wifi hotspot', which is deprecated now
2015-12-07 14:14:58 +01:00
Jiří Klimeš
3892b839af cli: add 'nmcli connection export' (rh #1034105)
Synopsis:
  nmcli connection export [ id | uuid | path] <ID> [<output file>]

for exporting VPN connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1034105
2015-12-07 09:11:20 +01:00
Jiří Klimeš
9a0e4bae47 cli: add 'nmcli connection import' (rh #1034105)
Synopsis:
  nmcli connection import [--temporary] type <type> file <file to import>

Only VPN configurations can be imported at the moment.

https://bugzilla.redhat.com/show_bug.cgi?id=1034105
2015-12-07 09:11:06 +01:00
Lubomir Rintel
9b49284f0c cli,devices: add device monitor 2015-12-05 12:16:04 +01:00
Beniamino Galvani
b614a5ec61 cli: add support for IP tunnel settings 2015-12-01 17:39:41 +01:00
Beniamino Galvani
c223e811f1 nmcli/bash-completion: add completion for 'tun' connection mode 2015-11-25 11:53:04 +01:00
Jiří Klimeš
0c65b28960 cli: add 'nmcli connection clone' for cloning connections (bgo #757627)
Synopsis:
nmcli connection clone [--temporary] [id|uuid|path] <ID> <new name>

It copies the <ID> connection as <new name>. The command is very useful
if there is a connection, but another one is needed for a related
configuration. One can copy the existing profile and modify it for the
new situation.

For example:
$ nmcli con clone main-eth second-eth
$ nmcli con modify second-eth connection.interface-name em4

https://bugzilla.gnome.org/show_bug.cgi?id=757627
2015-11-18 09:37:44 +01:00
Lubomir Rintel
4b7cb5a634 nmcli/bash-completion: fix --show-password parsing
Fixes: 2f52a10be1
2015-11-12 13:49:55 +01:00
Beniamino Galvani
5b3137984d cli: add command for displaying LLDP neighbors
The list of LLDP neighbors is available through the D-Bus interface
and libnm already provides functions to retrieve it; make the list
available through nmcli as well. Sample output:

  $ nmcli device lldp
  NEIGHBOR[0].DEVICE:                     eth0
  NEIGHBOR[0].CHASSIS-ID:                 00:13:21:58:CA:42
  NEIGHBOR[0].PORT-ID:                    1
  NEIGHBOR[0].PORT-DESCRIPTION:           1
  NEIGHBOR[0].SYSTEM-NAME:                ProCurve Switch 2600-8-PWR
  NEIGHBOR[0].SYSTEM-DESCRIPTION:         ProCurve J8762A Switch 2600-8-PWR, revision H.08.89
  NEIGHBOR[0].SYSTEM-CAPABILITIES:        20 (mac-bridge,router)
  NEIGHBOR[1].DEVICE:                     eth2
  NEIGHBOR[1].CHASSIS-ID:                 00:01:30:F8:AD:A2
  NEIGHBOR[1].PORT-ID:                    1/1
  NEIGHBOR[1].PORT-DESCRIPTION:           Summit300-48-Port 1001
  NEIGHBOR[1].SYSTEM-NAME:                Summit300-48
  NEIGHBOR[1].SYSTEM-DESCRIPTION:         Summit300-48 - Version 7.4e.1 (Build 5)
  NEIGHBOR[1].SYSTEM-CAPABILITIES:        20 (mac-bridge,router)

https://bugzilla.gnome.org/show_bug.cgi?id=757307
2015-11-10 14:06:02 +01:00
Jiří Klimeš
2f52a10be1 cli: add '--show-password' option for 'nmcli device wifi hotspot'
It is useful to show nmcli-generated hotspot password (if a user does not
provide his own password). Without the option the user would have to look into
the generated profile in order to find out the password.
2015-11-10 09:15:06 +01:00
Jiří Klimeš
781d24f1dd cli: add 'password' option for 'nmcli device wifi hotspot'
It allows user provided password to be used to secure the hotspot.
Otherwise, nmcli will generate a suitable password.
2015-11-10 09:10:48 +01:00
Jiří Klimeš
d6427d7198 cli: add 'nmcli device wifi hotspot' command
Synopsis:
nmcli device wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>]
                          [band a|bg] [channel <channel>]
2015-11-10 09:08:05 +01:00
Jiří Klimeš
91dde2c865 nmcli: fix bash completion of words containing colon (rh #1271271)
Test:
$ sudo ip link add a🅱️c type dummy
$ nmcli device delete<Tab><Tab>
$ nmcli device delete a<Tab>

See also:
http://stackoverflow.com/questions/28479216/how-to-give-correct-suggestions-to-tab-complete-when-my-words-contains-colons
http://stackoverflow.com/questions/2805412/bash-completion-for-maven-escapes-colon/12495727

Related: https://bugzilla.gnome.org/show_bug.cgi?id=745157

https://bugzilla.redhat.com/show_bug.cgi?id=1271271
2015-10-20 12:00:39 +02:00
Thomas Haller
fcc51f1ab7 nmcli/bash-completion: fix completion for device names for nmcli device set
Fixes: 7405d5c7b7
2015-09-21 18:25:50 +02:00
Jiří Klimeš
290c1626b9 cli: allow creating ADSL connections with 'nmcli connection add' (rh #1264089)
https://bugzilla.redhat.com/show_bug.cgi?id=1264089
2015-09-21 15:21:51 +02:00
Thomas Haller
7405d5c7b7 nmcli: extend nmcli device set command to accept explicit ifname specifier
Without it, you cannot set the properties of a device named "help".
Now you can with:

  $ nmcli device set ifname help autoconnect no
2015-09-18 13:14:44 +02:00
Lubomir Rintel
4dffbf8f6a cli: add nmcli device set command
Co-Authored-By: Thomas Haller <thaller@redhat.com>
2015-09-18 13:14:35 +02:00
Jiří Klimeš
5955a66e09 cli: fix connecting to a hidden SSID with 'nmcli dev wifi connect' (bgo #752173)
We have to set 802-11-wireless.hidden=true to be able to connect to hidden SSIDs.
nmcli user indicates hidden SSID with 'hidden yes' parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=752173
2015-08-14 12:42:56 +02:00
Jiří Klimeš
e247567d87 cli: add 'ssid' parameter for 'nmcli device wifi rescan'
'ssid' can repeat when more SSIDs should be scanned, e.g.
$ nmcli dev wifi rescan ssid "hidden cafe" ssid AP12 ssid "my home Wi-Fi"

Bash completion fixed by thaller@redhat.com
2015-08-14 12:42:15 +02:00
Thomas Haller
8c3f1812ea logging: support an "OFF" logging level
The only way to disable logging for a domain entirely is to
omit the domain from the "domains" list. For example:

  "level=INFO, domains=PLATFORM,..."

Now add an explicit level "OFF" to facilitate configuration like:

  "level=INFO, domains=ALL,WIFI_SCAN:OFF"

It also supports
  "level=OFF, domains=PLATFORM:INFO"
but this is for the most part equivalent to
  "level=INFO, domains=PLATFORM"
2015-08-04 11:21:57 +02:00
Jiří Klimeš
133996acbb cli: add 'slave-type' parameter for "nmcli con add" to bash completion
Fixes: 1375d9c13a
2015-07-15 16:00:18 +02:00
Lubomir Rintel
1ff98fca40 cli: add "nmcli c add master" to bash-completion
Remove the discouraged forms.
2015-07-12 15:46:37 +02:00
Lubomir Rintel
81f1e3da4f cli: add bash completion for 'nmcli c add -- <property list>'
Use the editor to obtain a list of possible properties for a type of
connection. Let 'nmcli c modify' completion reuse it as well, to avoid code
duplication.
2015-07-02 09:33:58 +02:00
Dan Winship
721e917cb6 wimax: drop WiMAX support (bgo #747846)
Even Fedora is no longer shipping the WiMAX SDK, so it's likely we'll
eventually accidentally break some of the code in src/devices/wimax/
(if we haven't already). Discussion on the list showed a consensus for
dropping support for WiMAX.

So, remove the SDK checks from configure.ac, remove the WiMAX device
plugin and associated manager support, and deprecate all the APIs.

For compatibility reasons, it is still possible to create and save
WiMAX connections, to toggle the software WiMAX rfkill state, and to
change the "WIMAX" log level, although none of these have any effect,
since no NMDeviceWimax will ever be created.

nmcli was only compiling in support for most WiMAX operations when NM
as a whole was built with WiMAX support, so that code has been removed
now as well. (It is still possible to use nmcli to create and edit
WiMAX connections, but those connections will never be activatable.)
2015-04-17 12:42:23 -04:00
Jiří Klimeš
b8a2f42a38 cli: allow multiple devices for 'nmcli device disconnect/delete' (bgo #746097)
Allow disconnecting and deleting multiple interfaces at a time. It is much
more user friendly. TAB and bash completions are supported as well.

https://bugzilla.gnome.org/show_bug.cgi?id=746097
2015-03-20 11:03:44 +01:00
Thomas Haller
81c420dc62 cli/completion: add completion for --order option
This does not yet work, because the --order option
contains colons which bash completion considers as
separaters.

For now, implement it and ignore that problem. It
works correctly until you specify more then one
order-columns separated by colon.

https://bugzilla.gnome.org/show_bug.cgi?id=738613

Fixes: 40e98f5d68
2015-03-02 14:02:58 +01:00
Thomas Haller
d0fbb688f5 cli/completion: add completion for --colors option
https://bugzilla.gnome.org/show_bug.cgi?id=738613

Fixes: 758e488f13
2015-02-23 18:31:01 +01:00
Thomas Haller
3cbce6994a nmcli/bash-completion: don't allow specifying connection by apath for 'connection modify'
The following must not be allowed:

  $ nmcli connection modify apath /org/freedesktop/NetworkManager/ActiveConnection/0
2014-12-22 15:39:48 +01:00
Thomas Haller
5ef233936a nmcli/bash-completion: fix detecting connection for connection modify
Previously we would only complete connections given by ID.
The following would work:
  $ nmcli connection modify id <ID> <TAB>
  $ nmcli connection modify <ID> <TAB>
  $ nmcli connection modify uuid <UUID> <TAB>
but the following would not work:
  $ nmcli connection modify <UUID> <TAB>
2014-12-22 15:28:00 +01:00
Thomas Haller
c3246d962d nmcli/bash-completion: complete [+-] modifier for connection modify property
Fixes
  nmcli connection modify CONNECTION +conn<TAB>
2014-12-01 15:22:10 +01:00
Jiří Klimeš
3a551664df cli: add 'nmcli agent' command (bgo #739568)
Synopsis:
nmcli agent { secret | polkit | all }

The command runs separate NetworkManager secret agent or session polkit agent, or both.
It is useful when
- no other secret agent is available (such as GUI nm-applet, gnome-shell, KDE applet)
- no other polkit agent is available (such as polkit-gnome-authentication-agent-1,
  polkit-kde-authentication-agent-1 or lxpolkit)

https://bugzilla.gnome.org/show_bug.cgi?id=739568
2014-11-07 11:58:25 +01:00