Jiří Klimeš
12f284dee3
cli: make Ctrl-C exit nmcli when line is empty *and* we are not in the editor
2014-06-24 10:58:42 +02:00
Jiří Klimeš
7e75ccea7f
cli: don't print "Error: nmcli terminated by signal Quit (3)" on Ctrl-D
...
Also make sure we don't print anything before quitting on Ctrl-D.
2014-06-24 10:52:16 +02:00
Jiří Klimeš
c0822f6054
cli: append NL to error messages and also print the signal name
2014-06-24 10:52:16 +02:00
Jiří Klimeš
dbf2d08559
cli: allow quitting on Ctrl-D while in readline()
...
Ctrl-D is mapped as a delete key in readline. When some input is on the line,
Ctrl-D behaves like 'Delete' key. When the line is empty, EOF is generated.
We quit on this EOF. It is the same behaviour many other interactive programs
exhibit, like bash, python, irb, etc.
Users can also quit unconditionally with Ctrl-\ that traditionally generates
SIGQUIT.
2014-06-24 10:52:15 +02:00
Jiří Klimeš
433c067522
cli: mitigate slowness of readline() for some broken versions
...
There was a bug in readline-6.2 causing very slow processing when
rl_event_hook was used [1]. This was fixed later after 6.2 was out.
Unfortunately some distributions don't include the fix. Fedora is one
example [2].
So we lower keyboard input timeout from 0.1s to 0.01s. This makes readline
more responsive. On the other hand it causes more interrupts, calling
rl_event_hook callback more often and thus slightly higher CPU usage.
[1] https://lists.gnu.org/archive/html/bug-readline/2012-06/msg00005.html
[2] related: https://bugzilla.redhat.com/show_bug.cgi?id=1109946
Note: this commit could (should) be reverted later when we check that most
distributions have the readline bug fixed.
2014-06-24 10:45:37 +02:00
Jiří Klimeš
512fe08c7e
cli: don't quit nmcli on Ctrl-C while in readline()
...
We rather cancel the input and show new prompt on readline. It is more
expected behaviour for interactive input when quitting.
2014-06-24 10:38:14 +02:00
Jiří Klimeš
530412134d
cli: make "(not available)" translatable
2014-06-20 13:58:36 +02:00
Dan Winship
8252ebd941
cli: generate setting docs from libnm-util/nm-setting-docs.xml
...
nmcli used the GParamSpec doc strings to get property descriptions,
but they will be going away. Generate a .c file from the new XML
setting docs file, and link that into nmcli.
2014-06-19 17:45:02 -04:00
Jiří Klimeš
f227d25ed9
cli: clarify nmcli description for route metric
2014-06-19 10:04:08 +02:00
Jiří Klimeš
7c41835203
cli: editor - do not print separator when printing one setting
2014-06-19 09:24:07 +02:00
Jiří Klimeš
9ab59bdfac
cli: editor - enhance TAB completion for 'print' command
2014-06-19 09:24:07 +02:00
Jiří Klimeš
e7830c7925
cli: editor - enhance 'print' command
...
- allow printing single properties:
nmcli> print con.id
connection.id: my-main-ethernet
- allow printing other settings in second (settings) menu level:
nmcli connection> print ipv4.method
ipv4.method: auto
nmcli connection> print eth
...
2014-06-19 09:23:07 +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š
e70d5579af
cli: don't accept prefix 0 for routes
2014-06-11 10:07:02 +02:00
Jiří Klimeš
4e9fc8ad61
cli: don't accept default route entries, NM handles the default route itself
2014-06-11 09:58:44 +02:00
Jiří Klimeš
700f5ec0ef
cli: allow missing next hop for routes (bgo #727615 )
...
https://bugzilla.gnome.org/show_bug.cgi?id=727615
2014-06-11 09:58:39 +02:00
Dan Williams
dacee1485a
cli: fix a couple errors noticed by coverity
2014-06-06 17:25:36 -05:00
Thomas Haller
bcb9f6c910
cli: fix error parsing input arguments in non-interactive mode
...
Causes the following failure:
$ /bin/nmcli connection add type ethernet con-name connie ifname '*'
(process:13883): GLib-CRITICAL **: g_strchug: assertion `string != NULL' failed
(process:13883): GLib-CRITICAL **: g_strchomp: assertion `string != NULL' failed
Error: invalid connection type; '' not among [generic, ...].
Regression introduced by commit bfb1200b4f
.
Signed-off-by: Thomas Haller <thaller@redhat.com >
2014-06-06 23:19:49 +02:00
Jiří Klimeš
dae8391436
cli: switch to the new-style readline typedefs (bgo #731294 )
...
The old Function, CPFunction, CPPFunction and VFunction typedefs are
considered deprecated starting from readline 4.2 (though were not marked
as such): http://lists.gnu.org/archive/html/bug-bash/2000-10/msg00078.html
Compatibility typedefs have been in place up to readline 6.2 but were
removed with the 6.3 release thus causing build to break.
http://lists.gnu.org/archive/html/bug-readline/2014-04/msg00018.html
https://bugzilla.gnome.org/show_bug.cgi?id=731294
2014-06-06 11:34:23 +02:00
Jiří Klimeš
82db87a144
cli: use readline for quit confirmation in editor, and accept localized answer
2014-06-04 09:47:37 +02:00
Jiří Klimeš
00c700bf2c
cli: implement TAB completion for connection and interface names
...
For commands like
nmcli -a dev disconnect
nmcli -a con up
...
2014-06-04 09:47:37 +02:00
Jiří Klimeš
bfb1200b4f
cli: implement TAB completion for inputs in questionnaire mode
...
and also
- accept yes/no options as localized strings
- simplify some questionnaire code
2014-06-04 09:47:37 +02:00
Jiří Klimeš
480f69e23f
cli: use readline also in other commands (besides interactive editor)
...
It is used for '--ask' option. The main use is for questionnaires
(nmcli -a con add).
2014-06-04 09:47:37 +02:00
Jiří Klimeš
b71af5b144
cli: make prompt argument a printf-like format string, remove history argument
...
for nmc_readline()
2014-06-04 09:47:37 +02:00
Jiří Klimeš
a3d89d65c4
cli: move readline related functions to common.h to be usable throughout nmcli
...
Renames
readline_x() to nmc_readline()
gen_func_basic() to nmc_rl_gen_func_basic()
The commit doesn't change functionality, only moves and renames the functions,
so that they can be used in other places too.
2014-06-04 09:47:37 +02:00
Jiří Klimeš
03be41d409
cli/build: make libreadline a build-time dependency (bgo #729846 )
...
and link nmcli against it.
This simplifies code, makes sure that line editing capability is supported,
and will allow using readline on other places too.
https://bugzilla.gnome.org/show_bug.cgi?id=729846
https://bugzilla.redhat.com/show_bug.cgi?id=1007365
2014-06-04 09:47:37 +02:00
Jiří Klimeš
fd93fb9fb9
cli: don't leak 'str' returned by g_strdup_vprintf()
2014-06-04 08:55:35 +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š
43edc90438
cli: support new bridge.mac-address property
2014-05-30 17:02:31 +02:00
Thomas Haller
c4d90c5660
cli: don't use nm_utils_hwaddr_type() to stringify HWADDR
...
Use nm_utils_hwaddr_ntoa_len() instead of nm_utils_hwaddr_ntoa().
This makes it no longer necessary to determine the type of the MAC
address based on the address length.
This makes the GETTER more accepting towards other lengths.
Signed-off-by: Thomas Haller <thaller@redhat.com >
2014-05-29 19:00:59 +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
Jiří Klimeš
649e4be103
cli: extract username and gateway for some more VPN types
2014-05-28 09:37:15 +02:00
Jiří Klimeš
98ae6e06d2
all: g_type_init() has been deprecated in GLib 2.35.0
...
g_type_init() deprecation:
https://bugzilla.gnome.org/show_bug.cgi?id=686161
2014-05-27 16:58:21 +02:00
Jiří Klimeš
6f9601030a
cli: add missing reason-to-string mappings for NMDeviceStateReason
2014-05-26 14:07:01 +02:00
Jiří Klimeš
e6f1c8329f
cli: TAB completion for connection.secondaries
...
We complete UUIDs, because that's easier (no spaces or special characters).
Readline display hook allows to display profile name too, though.
2014-05-23 12:19:29 +02:00
Jiří Klimeš
7696238e84
cli: only allow setting VPN connection as secondaries in editor
2014-05-23 12:19:29 +02:00
Jiří Klimeš
2b37ee2b7a
cli: fix completion of interfaces in editor for "activate" command
2014-05-15 13:43:02 +02:00
Jiří Klimeš
e8f5a82e22
cli: fix ambiguity of "o" (on vs off) in nmc_string_to_bool()
2014-05-15 09:50:52 +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
9ef23947cc
all: fix various warnings detected with coverity
...
https://bugzilla.gnome.org/show_bug.cgi?id=728320
Signed-off-by: Thomas Haller <thaller@redhat.com >
2014-05-02 15:20:30 +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
Dan Winship
bea82ca98b
all: set G_LOG_DOMAIN appropriately, for better g_log() messages
2014-04-23 10:19:17 -04:00
Jiří Klimeš
645f0204f9
nmcli: improve setting connection.secondaries property
...
- check if the values being set are existing connections
- also allow specifying connections by names, translating them transparently
to UUIDs.
- nmcli-specific section for 'describe' command added
(We use a global nm_cli variable in nmc_property_connection_set_secondaries())
2014-04-22 12:40:40 +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
Yuri Chornoivan
b25c227e07
fix typos in documentation and messages
...
https://bugzilla.gnome.org/show_bug.cgi?id=727031
Signed-off-by: Thomas Haller <thaller@redhat.com >
2014-04-03 17:12:31 +02:00
Dan Williams
408ecd6b5f
cli: fix setting DCB application priority (rh #1080510 )
...
Priority was originally a 'guint' but then got changed to 'gint' and
apparently we forgot to fix one place up.
2014-04-02 12:06:14 -05:00
Jiří Klimeš
c1e5493117
nmcli: use correct Mbit/s units for maximal bitrate (rh #1080474 )
...
https://bugzilla.redhat.com/show_bug.cgi?id=1080474
2014-04-01 15:15:17 +02:00
Jiří Klimeš
4209f170da
nmcli: fix an error when showing progress of activation in editor
...
(process:7213): CRITICAL **: nm_active_connectiuon_get_state: assertion `NM_IS_ACTIVE_CONNECTION (connection)' failed
2014-03-31 18:10:55 +02:00
Jiří Klimeš
a1e89b4d29
cli: fix bridge priority default value (rh #1073664 )
...
It is 32768 (0x8000) instead of 128 (0x80). 13c348d
fixes that in the setting.
https://bugzilla.redhat.com/show_bug.cgi?id=1073664
2014-03-17 09:08:23 +01:00
Jiří Klimeš
08ed6c5be2
cli: sanitize team config before setting it into property
...
Replace '\r' and '\n' chareacter with a space in the configuration.
libteamdctl sends the config to team daemon using its usock interface that
separates parameters with '\n'.
Related: rh #1051517
2014-03-12 10:44:29 +01:00