mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-01 00:58:00 +02:00
cli: fix completion of connection types
Return only main settings and the special slave types.
This commit is contained in:
parent
07cba18036
commit
ed824102ff
2 changed files with 29 additions and 5 deletions
|
|
@ -1137,8 +1137,13 @@ _rl_compentry_func_wrap_fcn (const char *text, int state)
|
|||
{
|
||||
g_return_val_if_fail (_rl_compentry_func_wrap.initialized, NULL);
|
||||
|
||||
if ( !_rl_compentry_func_wrap.values
|
||||
|| !_rl_compentry_func_wrap.values[_rl_compentry_func_wrap.idx]) {
|
||||
while ( _rl_compentry_func_wrap.values
|
||||
&& _rl_compentry_func_wrap.values[_rl_compentry_func_wrap.idx]
|
||||
&& !g_str_has_prefix (_rl_compentry_func_wrap.values[_rl_compentry_func_wrap.idx], text))
|
||||
_rl_compentry_func_wrap.idx++;
|
||||
|
||||
if ( !_rl_compentry_func_wrap.values
|
||||
|| !_rl_compentry_func_wrap.values[_rl_compentry_func_wrap.idx]) {
|
||||
g_strfreev (_rl_compentry_func_wrap.values);
|
||||
_rl_compentry_func_wrap.values = NULL;
|
||||
_rl_compentry_func_wrap.initialized = FALSE;
|
||||
|
|
|
|||
|
|
@ -4979,10 +4979,29 @@ gen_cmd_save (const char *text, int state)
|
|||
static rl_compentry_func_t *
|
||||
gen_connection_types (const char *text)
|
||||
{
|
||||
gs_strfreev char **values = NULL;
|
||||
gs_free char **values = NULL;
|
||||
const NMMetaSettingInfoEditor *editor;
|
||||
GPtrArray *array;
|
||||
int i;
|
||||
|
||||
array = g_ptr_array_new ();
|
||||
|
||||
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
|
||||
editor = &nm_meta_setting_infos_editor[i];
|
||||
if (!editor->valid_parts)
|
||||
continue;
|
||||
g_ptr_array_add (array, (gpointer) nm_meta_setting_infos[i].setting_name);
|
||||
if (editor->alias)
|
||||
g_ptr_array_add (array, (gpointer) editor->alias);
|
||||
}
|
||||
|
||||
g_ptr_array_add (array, "bond-slave");
|
||||
g_ptr_array_add (array, "bridge-slave");
|
||||
g_ptr_array_add (array, "team-slave");
|
||||
g_ptr_array_add (array, NULL);
|
||||
|
||||
values = (char **) g_ptr_array_free (array, FALSE);
|
||||
|
||||
values = _meta_abstract_complete ((const NMMetaAbstractInfo *) nm_meta_property_info_connection_type,
|
||||
text);
|
||||
return nmc_rl_compentry_func_wrap ((const char *const*) values);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue