Thomas Haller
2ea670ab96
cli: split output data from NmCli to a separate field
2017-03-30 13:34:35 +02:00
Thomas Haller
98ce4a8d5d
cli: separate input and in-out arguments in print_data()
...
Don't pass down the entire NmCli instance. The output_data
array is modified by print_data(), the rest is read-only input.
2017-03-30 13:09:59 +02:00
Thomas Haller
e847d0f121
cli: pass configuration options separately from NmCli structure
...
The NmCli structure is passed around everywhere and contains all
the state of the program. It is very hard to follow which parts
are used where.
Split out more configuration options to a NmcConfig field. This field
is mostly immutable, and modified at particular places that now can be
easily found.
2017-03-30 13:09:59 +02:00
Thomas Haller
9359d5622e
cli: pass use_colors as separate option instead of global nmc
...
nmc contains all options and collects output data. It is very hard to
understand what it does. Start splitting it up, and pass arguments along
-- as needed.
2017-03-30 13:09:59 +02:00
Thomas Haller
a63c4d0824
cli: use designated initializers for setting NmcOutputField fields
...
Otherwise, changing the structure is difficult because it all depends
on the order (and you don't immdiately see which field is used where).
Also, drop the name_l10n field.
2017-03-30 13:09:58 +02:00
Thomas Haller
23298bfc88
cli: move utils function from common.h to nm-meta-setting-desc.c
...
These functions are only used by nm-meta-setting-desc.c. Make them internal.
Unfortunately, they are part of "common.h" which cannot be used without
the rest of nmcli. Still todo.
2017-03-30 13:09:58 +02:00
Francesco Giudici
ef0d0d08eb
nmcli: fix nmcli parsing
...
Fixes the parsing for correct and incorrect commands.
e.g.:
nmcli connection down id <conn>
nmcli -t
...
Fixes: 16902a2be6
2017-03-29 13:02:39 +02:00
Lubomir Rintel
5a71bc8022
cli: add NmCli argument to next_arg()
...
Will be useful in next commit.
2017-03-28 15:32:05 +02:00
Lubomir Rintel
16902a2be6
cli: use next_arg() on argument boundary
...
Shift argc and argc manually between argument ant its value and use
next_arg() between arguments everywhere. Whill be useful to parse global
arguments.
2017-03-28 15:32:05 +02:00
Francesco Giudici
a62b72272f
nmcli: fix missing CONNECTIONS section name from nmcli -f all -m tab dev show <dev>
...
When a full section is specified as the field parameter in terse tabular
mode, the section name should be printed followed by all the field values
belonging to that section separated by ':'. The NAME of section CONNECTIONS
was missing.
sample command:
$ nmcli -m tab -t -f CONNECTIONS device show ens3
previous output was:
/org/freedesktop/NetworkManager/Settings/{1}:5059XXX-XXXX.. | ens3-dhcp
now:
CONNECTIONS:/org/freedesktop/NetworkManager/Settings/{1}:5059XXX-XXXX.. | ens3-dhcp
2017-03-28 10:55:00 +02:00
Francesco Giudici
7d96f1f17d
nmcli: don't enforce anymore the -f(ields) option in -t(erse) mode
2017-03-28 10:55:00 +02:00
Francesco Giudici
4fa2e1422d
nmcli: (trivial) add comment
2017-03-28 10:55:00 +02:00
Francesco Giudici
cf39ef52da
nmcli: remove redundant check
2017-03-28 10:55:00 +02:00
Lubomir Rintel
84c484ed5b
cli: make match() return boolean
...
Coccinelle semantic patch:
@@
@@
-int
+gboolean
matches (...);
@@
expression pattern, cmd, len;
@@
-int
+gboolean
matches (...)
{
...
- return memcmp (pattern, cmd, len);
+ return memcmp (pattern, cmd, len) == 0;
}
@@
expression prefix, str;
@@
(
-matches (prefix, str) != 0
+!matches (prefix, str)
|
-matches (prefix, str) == 0
+matches (prefix, str)
)
@@
expression prefix, str;
@@
-(matches (prefix, str))
+matches (prefix, str)
@@
expression prefix, str;
@@
-(!matches (prefix, str))
+!matches (prefix, str)
spatch --smpl-spacing --sp-file match.cocci --dir clients/cli/ \
--include-headers --macro-file shared/nm-utils/gsystem-local-alloc.h
2017-02-15 13:04:07 +01:00
Lubomir Rintel
01a20015e0
cli: use nmc_do_cmd to get the client and check if the daemon is running
...
The makes use of asynchronous client initialization, making things a bit
faster and reduces code duplication too.
2016-11-11 16:18:03 +01:00
Lubomir Rintel
3ee03afecc
cli: make it possible to call sub-commands with client obtained asynchronously
2016-11-11 16:18:03 +01:00
Lubomir Rintel
6499bb893f
cli: get rid of client-global connections list
...
Caching it in the NmCli object is unnecessary, ugly and would be cumbersome in
future when we'll be creating the client object only when needed.
2016-11-11 16:18:03 +01:00
Thomas Haller
45c0518a5e
cli: fix synopsis for hotspot arguments for nmcli device wifi --help
2016-10-12 15:15:19 +02:00
Thomas Haller
29b576bd70
proxy: cleanup handling of proxy-method
...
The numeric value of NM_SETTING_PROXY_METHOD_NONE should be zero,
as that is the more natural default.
Also, cast all uses of the enum values in g_object_set() to
(int).
2016-10-05 14:46:18 +02:00
Atul Anand
2cb75e08d6
nmcli: Add Proxy support to nmcli
...
nmcli fixed to allow users edit proxy properties.
2016-10-04 11:44:44 +02:00
Jiří Klimeš
1f0ba2e487
cli: (trivial) move gen_func_ifnames() from devices.c to common.c
...
and rename it to nmc_rl_gen_func()
2016-09-19 16:55:39 +02:00
Beniamino Galvani
b28b2ba8a9
clients: add define for NMSecretAgentSimple signal name
2016-09-14 23:32:52 +02:00
Lubomir Rintel
8cc6ce7e44
cli: add -f argument completion
2016-08-01 15:51:29 +02:00
Lubomir Rintel
2c24de5814
cli/device: add completion to wifi hotspot subcommand
2016-08-01 13:52:36 +02:00
Lubomir Rintel
1a0dfd31c4
cli/device: add completion to wifi connect subcommand
2016-08-01 13:52:36 +02:00
Lubomir Rintel
8679793f6b
cli/device: add completion to wifi list subcommand
2016-08-01 13:52:36 +02:00
Lubomir Rintel
efd22c24e8
cli/device: add completion to wifi rescan subcommand
2016-08-01 13:52:36 +02:00
Lubomir Rintel
3068886043
cli/device: export some useful completion functions
...
Wi-Fi access point completion functionality and stuff useful for completing
"ifname" and "ap" for "nmcli c up".
2016-08-01 13:52:36 +02:00
Lubomir Rintel
4302e05b1a
cli/device: make it possible to limit completion to wifis
2016-08-01 13:52:36 +02:00
Lubomir Rintel
d2842d16e3
cli/device: replace some duplicate code with find_wifi_device_by_iface()
2016-08-01 13:52:36 +02:00
Lubomir Rintel
1d8ab4e276
cli/device: make devices_idx argument to find_wifi_device_by_iface() optional
...
Most callers don't use it.
2016-08-01 13:52:36 +02:00
Lubomir Rintel
f32285f03f
cli/device: make find_wifi_device_by_iface use sorted device array
...
...as opposed to GPtrArray. The point is to be able to have a single device
list that could be later reused with complete_device().
2016-08-01 13:52:36 +02:00
Lubomir Rintel
58caeea846
cli/trivial: move find_ap_on_device() up
2016-08-01 13:52:36 +02:00
Lubomir Rintel
ed215dc372
cli/trivial: move find_wifi_device_by_iface() up
2016-08-01 13:52:36 +02:00
Lubomir Rintel
402828d2ed
cli/devices: export device_state_to_color()
...
Also, get rid of the ColorInfo structure. It was not too nice anyway.
2016-07-19 14:29:05 +02:00
Jiří Klimeš
c875471430
nmcli: fix 'nmcli device modify' description
...
Fixes: 8b4494598d
2016-07-15 12:26:24 +02:00
Jiří Klimeš
887cdcc217
nmcli: remove the extra full stop from error messages
...
$ nmcli dev modify
Error: No interface specified..
$ nmcli dev modify bla
Error: Device 'bla' not found..
2016-07-15 11:43:32 +02:00
Lubomir Rintel
9dafcc8b26
cli/device: allow completion of the "wifi" command name
...
That's the "wifi" string itself. The subcommands need some work.
2016-06-29 20:49:34 +02:00
Lubomir Rintel
b8bc57c9d3
cli/device: add "lldp list" subcommand completion
2016-06-29 20:49:34 +02:00
Lubomir Rintel
08969b1789
cli: make subcommand dispatch do autocompletion
2016-06-29 20:49:34 +02:00
Lubomir Rintel
39f6d5a5ba
cli/device: make "lldp list" subcommand use get_device()
2016-06-29 20:44:05 +02:00
Lubomir Rintel
95a13ef100
cli/device: make "set" subcommand use get_devices()
2016-06-29 20:39:09 +02:00
Lubomir Rintel
78c4038d8c
cli/device: convert lldp subcommand to nmc_do_cmd()
2016-06-29 20:32:31 +02:00
Lubomir Rintel
05108ca975
cli/device: convert wifi subcommand to nmc_do_cmd()
2016-06-29 20:32:31 +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
Lubomir Rintel
c054b871f7
cli/device: add device name completion
...
Useful with connect, disconnect, delete, monitor, show and reapply.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
59bc820e66
cli/device: split get_device()
...
Parsing a single device name from the command line is generally
useful. Remove the open coded versions in reapply, connect & status.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
55d349bc34
cli/trivial: rename device_list() to get_device_list()
...
It will look nicer when we have get_device().
2016-06-29 20:28:42 +02:00
Lubomir Rintel
5182ab3d5d
cli/device: use nmc_do_cmd()
2016-06-29 20:28:42 +02:00
Lubomir Rintel
a30224f6af
cli: use should_wait consistently
...
It's a semaphore, not a boolean.
2016-06-29 20:28:42 +02:00