mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 18:54:36 +00:00
docs: generate nm-settings-docs-nmcli.xml based on nmcli meta data
We have the correct meta-data of supported properties for nmcli. It is in clients/common. Use that for generating the manual page instead of the properties that are part of libnm (some properties may be in libnm but not supported by nmcli, or some properties may not be GObject properties, and not detected as by GObject introspection).
This commit is contained in:
parent
87edf2f298
commit
10020a9466
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -157,6 +157,9 @@ test-*.trs
|
||||||
/libnm/tests/test-remote-settings-client
|
/libnm/tests/test-remote-settings-client
|
||||||
/libnm/tests/test-secret-agent
|
/libnm/tests/test-secret-agent
|
||||||
|
|
||||||
|
/clients/cli/generate-docs-nm-settings-nmcli
|
||||||
|
/clients/cli/generate-docs-nm-settings-nmcli.xml
|
||||||
|
|
||||||
/m4/codeset.m4
|
/m4/codeset.m4
|
||||||
/m4/gettext.m4
|
/m4/gettext.m4
|
||||||
/m4/glibc2.m4
|
/m4/glibc2.m4
|
||||||
|
|
44
Makefile.am
44
Makefile.am
|
@ -1559,6 +1559,7 @@ libnm/libnm.typelib: libnm/libnm.gir
|
||||||
INTROSPECTION_GIRS += libnm/NM-1.0.gir
|
INTROSPECTION_GIRS += libnm/NM-1.0.gir
|
||||||
|
|
||||||
libnm_noinst_data = \
|
libnm_noinst_data = \
|
||||||
|
clients/cli/generate-docs-nm-settings-nmcli.xml \
|
||||||
libnm/nm-property-infos-dbus.xml \
|
libnm/nm-property-infos-dbus.xml \
|
||||||
libnm/nm-property-infos-ifcfg-rh.xml \
|
libnm/nm-property-infos-ifcfg-rh.xml \
|
||||||
libnm/nm-property-infos-keyfile.xml \
|
libnm/nm-property-infos-keyfile.xml \
|
||||||
|
@ -1570,6 +1571,9 @@ libnm_noinst_data = \
|
||||||
|
|
||||||
noinst_DATA += $(libnm_noinst_data)
|
noinst_DATA += $(libnm_noinst_data)
|
||||||
|
|
||||||
|
clients/cli/generate-docs-nm-settings-nmcli.xml: clients/cli/generate-docs-nm-settings-nmcli
|
||||||
|
$(AM_V_GEN) clients/cli/generate-docs-nm-settings-nmcli > $@
|
||||||
|
|
||||||
libnm_docs_sources = $(libnm_core_lib_c_settings_real)
|
libnm_docs_sources = $(libnm_core_lib_c_settings_real)
|
||||||
|
|
||||||
libnm/nm-property-infos-%.xml: tools/generate-docs-nm-property-infos.pl $(libnm_docs_sources)
|
libnm/nm-property-infos-%.xml: tools/generate-docs-nm-property-infos.pl $(libnm_docs_sources)
|
||||||
|
@ -1585,6 +1589,9 @@ libnm/nm-settings-docs-gir.xml: tools/generate-docs-nm-settings-docs-gir.py libn
|
||||||
--gir $(builddir)/libnm/NM-1.0.gir \
|
--gir $(builddir)/libnm/NM-1.0.gir \
|
||||||
--output $@
|
--output $@
|
||||||
|
|
||||||
|
man/nm-settings-docs-nmcli.xml: clients/cli/generate-docs-nm-settings-nmcli.xml libnm/nm-property-infos-nmcli.xml libnm/nm-settings-docs-gir.xml tools/generate-docs-nm-settings-docs-merge.py
|
||||||
|
$(AM_V_GEN) "$(PYTHON)" $(srcdir)/tools/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,3,$^)
|
||||||
|
|
||||||
man/nm-settings-docs-%.xml: libnm/nm-property-infos-%.xml libnm/nm-settings-docs-gir.xml tools/generate-docs-nm-settings-docs-merge.py
|
man/nm-settings-docs-%.xml: libnm/nm-property-infos-%.xml libnm/nm-settings-docs-gir.xml tools/generate-docs-nm-settings-docs-merge.py
|
||||||
$(AM_V_GEN) "$(PYTHON)" $(srcdir)/tools/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^)
|
$(AM_V_GEN) "$(PYTHON)" $(srcdir)/tools/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^)
|
||||||
|
|
||||||
|
@ -4559,6 +4566,43 @@ uninstall_hook += uninstall-hook-nmcli
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
noinst_PROGRAMS += clients/cli/generate-docs-nm-settings-nmcli
|
||||||
|
|
||||||
|
clients_cli_generate_docs_nm_settings_nmcli_SOURCES = \
|
||||||
|
clients/cli/generate-docs-nm-settings-nmcli.c \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
clients_cli_generate_docs_nm_settings_nmcli_CPPFLAGS = \
|
||||||
|
-I$(srcdir)/clients/common \
|
||||||
|
$(clients_cppflags) \
|
||||||
|
-DG_LOG_DOMAIN=\""nmcli"\" \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
clients_cli_generate_docs_nm_settings_nmcli_LDADD = \
|
||||||
|
clients/common/libnmc.la \
|
||||||
|
clients/common/libnmc-base.la \
|
||||||
|
libnm/nm-libnm-aux/libnm-libnm-aux.la \
|
||||||
|
libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \
|
||||||
|
libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||||
|
libnm/libnm.la \
|
||||||
|
shared/nm-glib-aux/libnm-glib-aux.la \
|
||||||
|
shared/nm-std-aux/libnm-std-aux.la \
|
||||||
|
shared/libcsiphash.la \
|
||||||
|
$(GLIB_LIBS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
clients_cli_generate_docs_nm_settings_nmcli_LDFLAGS = \
|
||||||
|
-Wl,--version-script="$(srcdir)/linker-script-binary.ver" \
|
||||||
|
$(SANITIZER_EXEC_LDFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
$(clients_cli_generate_docs_nm_settings_nmcli_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||||
|
$(clients_cli_generate_docs_nm_settings_nmcli_OBJECTS): $(libnm_lib_h_pub_mkenums)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
clients/cli/nmcli-completion \
|
clients/cli/nmcli-completion \
|
||||||
clients/cli/meson.build \
|
clients/cli/meson.build \
|
||||||
|
|
57
clients/cli/generate-docs-nm-settings-nmcli.c
Normal file
57
clients/cli/generate-docs-nm-settings-nmcli.c
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
|
#include "nm-default.h"
|
||||||
|
|
||||||
|
#include "nm-meta-setting-desc.h"
|
||||||
|
|
||||||
|
#define INDENT 4
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_xml_escape_attribute (const char *value)
|
||||||
|
{
|
||||||
|
gs_free char *s = NULL;
|
||||||
|
|
||||||
|
s = g_markup_escape_text (value, -1);
|
||||||
|
return g_strdup_printf ("\"%s\"", s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
_indent_level (guint num_spaces)
|
||||||
|
{
|
||||||
|
static const char spaces[] = " ";
|
||||||
|
|
||||||
|
nm_assert (num_spaces < G_N_ELEMENTS (spaces));
|
||||||
|
return &spaces[G_N_ELEMENTS (spaces) - num_spaces - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int i_sett_infos;
|
||||||
|
int i_property;
|
||||||
|
|
||||||
|
g_print ("<nm-setting-docs>\n");
|
||||||
|
for (i_sett_infos = 0; i_sett_infos < G_N_ELEMENTS (nm_meta_setting_infos_editor); i_sett_infos++) {
|
||||||
|
const NMMetaSettingInfoEditor *sett_info = &nm_meta_setting_infos_editor[i_sett_infos];
|
||||||
|
gs_free char *tmp1 = NULL;
|
||||||
|
|
||||||
|
g_print ("%s<setting", _indent_level (INDENT));
|
||||||
|
g_print (" name=%s >\n", tmp1 = _xml_escape_attribute (sett_info->general->setting_name));
|
||||||
|
|
||||||
|
for (i_property = 0; i_property < sett_info->properties_num; i_property++) {
|
||||||
|
const NMMetaPropertyInfo *prop_info = sett_info->properties[i_property];
|
||||||
|
gs_free char *tmp2 = NULL;
|
||||||
|
gs_free char *tmp3 = NULL;
|
||||||
|
|
||||||
|
g_print ("%s<property", _indent_level (2*INDENT));
|
||||||
|
g_print (" name=%s", tmp2 = _xml_escape_attribute (prop_info->property_name));
|
||||||
|
if (prop_info->property_alias)
|
||||||
|
g_print ("\n%salias=%s", _indent_level (2*INDENT + 10), tmp3 = _xml_escape_attribute (prop_info->property_alias));
|
||||||
|
g_print (" />\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
g_print ("%s</setting>\n", _indent_level (INDENT));
|
||||||
|
}
|
||||||
|
g_print ("</nm-setting-docs>\n");
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
name = 'nmcli'
|
if enable_nmcli
|
||||||
|
|
||||||
# FIXME: nmcli-completion should be renamed to nmcli
|
# FIXME: nmcli-completion should be renamed to nmcli
|
||||||
install_data(
|
install_data(
|
||||||
|
@ -8,15 +8,8 @@ install_data(
|
||||||
install_dir: join_paths(nm_datadir, 'bash-completion', 'completions'),
|
install_dir: join_paths(nm_datadir, 'bash-completion', 'completions'),
|
||||||
)
|
)
|
||||||
|
|
||||||
deps = [
|
|
||||||
libnmc_base_dep,
|
|
||||||
libnmc_dep,
|
|
||||||
readline_dep,
|
|
||||||
libnm_libnm_aux_dep,
|
|
||||||
]
|
|
||||||
|
|
||||||
executable(
|
executable(
|
||||||
name,
|
'nmcli',
|
||||||
files(
|
files(
|
||||||
'agent.c',
|
'agent.c',
|
||||||
'common.c',
|
'common.c',
|
||||||
|
@ -28,9 +21,38 @@ executable(
|
||||||
'settings.c',
|
'settings.c',
|
||||||
'utils.c',
|
'utils.c',
|
||||||
),
|
),
|
||||||
dependencies: deps,
|
dependencies: [
|
||||||
c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)],
|
libnmc_base_dep,
|
||||||
|
libnmc_dep,
|
||||||
|
readline_dep,
|
||||||
|
libnm_libnm_aux_dep,
|
||||||
|
],
|
||||||
|
c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format('nmcli')],
|
||||||
link_args: ldflags_linker_script_binary,
|
link_args: ldflags_linker_script_binary,
|
||||||
link_depends: linker_script_binary,
|
link_depends: linker_script_binary,
|
||||||
install: true,
|
install: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
generate_docs_nm_settings_nmcli = executable(
|
||||||
|
'generate-docs-nm-settings-nmcli',
|
||||||
|
files(
|
||||||
|
'generate-docs-nm-settings-nmcli.c',
|
||||||
|
),
|
||||||
|
dependencies: [
|
||||||
|
libnmc_base_dep,
|
||||||
|
libnmc_dep,
|
||||||
|
libnm_libnm_aux_dep,
|
||||||
|
],
|
||||||
|
c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format('nmcli')],
|
||||||
|
link_args: ldflags_linker_script_binary,
|
||||||
|
link_depends: linker_script_binary,
|
||||||
|
)
|
||||||
|
|
||||||
|
generate_docs_nm_settings_nmcli_xml = custom_target(
|
||||||
|
'generate-docs-nm-settings-nmcli.xml',
|
||||||
|
output: 'generate-docs-nm-settings-nmcli.xml',
|
||||||
|
command: [ generate_docs_nm_settings_nmcli ],
|
||||||
|
capture: true,
|
||||||
|
)
|
||||||
|
|
|
@ -19,10 +19,7 @@ executable(
|
||||||
)
|
)
|
||||||
|
|
||||||
subdir('common')
|
subdir('common')
|
||||||
|
subdir('cli')
|
||||||
if enable_nmcli
|
|
||||||
subdir('cli')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if enable_nmtui
|
if enable_nmtui
|
||||||
subdir('tui')
|
subdir('tui')
|
||||||
|
|
|
@ -69,7 +69,6 @@ if enable_introspection
|
||||||
nm_property_infos_xml[name],
|
nm_property_infos_xml[name],
|
||||||
nm_settings_docs_xml_gir,
|
nm_settings_docs_xml_gir,
|
||||||
],
|
],
|
||||||
depends: libnm_gir,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
name = 'nmcli'
|
name = 'nmcli'
|
||||||
|
@ -81,10 +80,10 @@ if enable_introspection
|
||||||
python.path(),
|
python.path(),
|
||||||
join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-merge.py'),
|
join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-merge.py'),
|
||||||
'@OUTPUT@',
|
'@OUTPUT@',
|
||||||
|
generate_docs_nm_settings_nmcli_xml,
|
||||||
nm_property_infos_xml[name],
|
nm_property_infos_xml[name],
|
||||||
nm_settings_docs_xml_gir,
|
nm_settings_docs_xml_gir,
|
||||||
],
|
],
|
||||||
depends: libnm_gir,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
nm_settings_docs_xml = {
|
nm_settings_docs_xml = {
|
||||||
|
|
Loading…
Reference in a new issue