Commit 937eb485 authored by Jiří Klimeš's avatar Jiří Klimeš

cli: 'connection edit' - edit/add connections in an interactive editor

nmcli connection edit [type <type>] [con-name <name>]

Examples:
nmcli c e
nmcli c e type ethernet
nmcli c e type wifi con-name "My home Wi-Fi"
nmcli c e type bond
...
parent 801434ce
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -46,6 +46,36 @@
#include "nmcli.h"
#include "utils.h"
/* --- Types --- */
typedef NMSetting* (*NmcSettingNewFunc) (void);
/* --- Functions --- */
void nmc_properties_init (void);
void nmc_properties_cleanup (void);
NmcSettingNewFunc nmc_setting_new_func (const char *name);
void nmc_setting_custom_init (NMSetting *setting);
char **nmc_setting_get_valid_properties (NMSetting *setting);
char *nmc_setting_get_property_desc (NMSetting *setting, const char *prop);
const char *nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop);
char *nmc_setting_get_property (NMSetting *setting,
const char *prop,
GError **error);
gboolean nmc_setting_set_property (NMSetting *setting,
const char *prop,
const char *val,
GError **error);
gboolean nmc_setting_remove_property_option (NMSetting *setting,
const char *prop,
const char *option,
guint32 idx,
GError **error);
void nmc_property_set_default_value (NMSetting *setting, const char *prop);
gboolean setting_details (NMSetting *ssetting, NmCli *nmc);
......
......@@ -14,7 +14,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 - 2012 Red Hat, Inc.
* (C) Copyright 2010 - 2013 Red Hat, Inc.
*/
/* Generated configuration file */
......@@ -436,6 +436,48 @@ finish:
return ret;
}
/*
* Convert string array (char **) to GSList.
*
* Returns: pointer to newly created GSList. Caller should free it.
*/
GSList *
nmc_util_strv_to_slist (char **strv)
{
GSList *list = NULL;
guint i = 0;
while (strv && strv[i])
list = g_slist_prepend (list, g_strdup (strv[i++]));
return g_slist_reverse (list);
}
/*
* Wrapper function for g_strsplit_set() that removes empty strings
* from the vector as they are not useful in most cases.
*/
char **
nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens)
{
char **result;
uint i;
uint j;
result = g_strsplit_set (str, delimiter, max_tokens);
/* remove empty strings */
for (i = 0; result && result[i]; i++) {
if (*(result[i]) == '\0') {
g_free (result[i]);
for (j = i; result[j]; j++)
result[j] = result[j + 1];
i--;
}
}
return result;
}
/*
* Find out how many columns an UTF-8 string occupies on the screen
*/
......
......@@ -14,7 +14,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 - 2012 Red Hat, Inc.
* (C) Copyright 2010 - 2013 Red Hat, Inc.
*/
#ifndef NMC_UTILS_H
......@@ -70,6 +70,8 @@ void nmc_terminal_show_progress (const char *str);
char *nmc_get_user_input (const char *ask_str);
int nmc_string_to_arg_array (const char *line, const char *delim, char ***argv, int *argc);
const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error);
GSList *nmc_util_strv_to_slist (char **strv);
char **nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens);
int nmc_string_screen_width (const char *start, const char *end);
void set_val_str (NmcOutputField fields_array[], guint32 index, char *value);
void set_val_strc (NmcOutputField fields_array[], guint32 index, const char *value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment