Commit Graph

20 Commits

Author SHA1 Message Date
Jiří Klimeš
18817877ad cli: confirm connection saving when autoconnect=yes (rh #953296)
Ask for confirmation in these cases:
* autoconnect=yes and connection has not been saved yet
* autoconnect=yes, but saved connection had autoconnect=no

The confirmation can be switched off with
nmcli> nmcli save-confirmation no
2013-07-30 14:04:52 +02:00
Jiří Klimeš
ca1c0cdaf4 cli: add 'nmcli' command for nmcli connection editor configuration
- show/hide status line:  nmcli> nmcli status-line yes | no
- editor prompt color:    nmcli> nmcli prompt-color <0-8>  (0 = normal/without color)
2013-07-22 13:37:16 +02:00
Jiří Klimeš
e6870789b5 cli: enhance printing to align tabular output properly and not to waste space
Until now we have used a static width defined for each column for tabular
output. Even if this worked in most cases, it was not optimal, because by
using too wide columns we wasted space, and in case of a too narrow column the
alignment broke. So, we need to know the longest string in a column to be able
to align columns in the tabular output. Thus, the printing has to be postponed
till we have all data available, and can find the widest column. This value is
then used for aligning while printing the data.

Arrays of NmcOutputField (rows) are inserted into output_data array. When all
data have been added, print_data() can be used to print the whole output_data
array with proper alignment.

A single row can be printed using print_required_fields().

Also, output flags are redone to better match the new output_data array.
The flags are needed for every row (in tabular output); they are stored in
the first field (NmcOutputField) for the whole row.

Addapted set_val_str() and set_val_arr() to set value type (char * x char **).
Added set_val_strc(), set_val_arrc() for const values that should not be freed.

output_data takes ownership of the data added to it and takes care of freeing
the memory.

See e.g.
https://bugzilla.gnome.org/show_bug.cgi?id=699503
2013-05-31 09:38:03 +02:00
Jiří Klimeš
981a687f77 cli: add '--ask' global option
It will be used to ask user for required but missing data/parameters.
2013-04-08 16:09:23 -05:00
Jiří Klimeš
113d358ce5 cli: make 'value' in NmcOutputField non const 2013-03-26 12:15:49 -04:00
Jiří Klimeš
853803c2f0 cli: use an error quark for domain in g_set_error() instead of 0 (rh #842975)
glib 2.32 makes a runtime check that domain is not NULL:
GLib-WARNING **: (gerror.c:390):g_error_new_valist: runtime check failed: (domain != 0)
2012-07-25 13:57:45 +02:00
Jiří Klimeš
659c22ccf6 cli: fix 'nmcli con delete' (rh #771258)
The command didn't delete the connection, because nmcli exited before NM could
check permissions (actually ConsoleKit didn't see the process).
Now nmcli waits for "Removed" signal or D-Bus return (error) message on "Delete"
method call.
2012-01-10 16:30:04 +01:00
Jiří Klimeš
c15d047b46 cli: allow field values to be null-terminated string arrays
Field values can now be string arrays. print_fields() recognizes the format and
prints values accordingly.
Setter functions was added to facilitate setting string vs. array:
set_val_str(), set_val_arr()
2012-01-03 15:07:17 +01:00
Jiří Klimeš
a9a30eb08c cli: compare nmcli and NM versions
nmcli gets NM version and compares it with its own and complains
when they differ. This is to indicate that the results are not reliable,
because the API could differ. '--nocheck' switches the checks off.
2011-02-16 17:36:50 +01:00
Dan Williams
6d344a43e9 Merge remote-tracking branch 'origin/rm-userset'
There; it's merged.  Yay!
2011-02-12 22:51:12 -06:00
Jiří Klimeš
f29b709590 cli: improve/add NM running checks
Check whether NetworkManager is running and return new error
NMC_RESULT_ERROR_NM_NOT_RUNNING when appropriate.
2011-02-10 14:39:47 +01:00
Daniel Gnoutcheff
4d1681ef09 libnm-glib: merge nm-remote-settings{,-system}
Originally, nm-remote-settings was used by the daemon to monitor the
user settings service, and its subclass nm-remote-settings-system was
used by NM clients to monitor the system settings service. With user
settings services gone, this distinction is no longer needed. Simplify
things a bit and merge the classes.
2010-08-06 13:05:46 -04:00
Daniel Gnoutcheff
c17d0b0980 nmcli: remove user settings support
Remove all support for user settings services from nmcli. Update its
manpage to reflect this.

Manpage edits also anticipate changes to be made in regards to how
secrets are managed.
2010-08-06 13:05:46 -04:00
Jiří Klimeš
28d5b67d84 cli: wait a bit even when '--nowait' is specified; for permissions check (rh #614866)
NetworkManager checks clients' permissions on requests, so nmcli mustn't quit too early
to give NM a chance to reach it on D-Bus.
2010-07-29 16:16:20 +02:00
Jiří Klimeš
87bf00b3d7 cli: multiline mode is default for 'dev list' and 'con list id|uuid'
Option '--multiline' was replaced with '--mode tabular|multiline'.
It was neccessary to be able to switch to tabular output mode for
'dev list' and 'con list id|uuid' commands as they now print out
in multiline mode by default. All other commands are in tabular
mode by default.
2010-04-06 16:22:01 +02:00
Jiří Klimeš
a91da03b65 cli: 'dev list' adjustments
Modifications are mainly for multiline mode to ease parsing - each
field name is prefixed with a section name.
'dev list' now also supports printing particular sections specifed via
'--fields' option.
2010-03-24 19:05:35 +01:00
Jiří Klimeš
31970798bc cli: add NMC_RESULT_ERROR_USER_INPUT code for bad invocation of nmcli 2010-03-24 13:42:47 +01:00
Jiří Klimeš
21638ff470 cli: convert 'dev list' to new format; checking options validity for terse 2010-03-22 18:43:28 +01:00
Jiří Klimeš
55949277bd cli: changing nmcli output to better fit both computer and human needs
The output is basically tabular with fields (columns) presenting specific pieces of info.
Each line represents a single object. It's possible to switch to multiline output using
'--multiline' option. In that mode single object is presented on more lines - each field
on its line.
Terse mode now uses ':' as field separator. It also escapes all occurences of ':' and '\'
inside field values to ease parsing. The escaping behaviour can be controlled through
'--escape' option. By default, escaping is switched on in tabular mode. When using terse
mode ('--terse'), '--fields' option is mandatory for specifying required fields. That helps
for flexibility and backwards compatibility.
Not all output is converted yet.
2010-03-18 15:39:15 +01:00
Jirka Klimes
c2ec07f17d cli: add initial pieces of nmcli 2010-02-25 09:52:30 -08:00