NetworkManager/src/nmcli
Thomas Haller 4cf94f30c7
nmcli: add nmc_print()/nmc_printerr() macros
These will replace the direct calls to g_print()/g_printerr() in nmcli.
There are two purposes.

1) the new macros embody the concept of "printing something from nmcli".
   It means, we can `git grep` for those functions, and find all the
   relevant places, without hitting the irrelevant ones (e.g. tests that
   also use g_print()).

2) by having one place, we can trivially change it. That is useful for
   printf debugging. For example, "test-client.py" runs nmcli and
   captures and compares the output.  With libnm we can set
   LIBNM_CLIENT_DEBUG and LIBNM_CLIENT_DEBUG_FILE to print libnm debug
   messages to a file. But we cannot trivially synchronize the messages
   from nmcli with that output (also because they are consumed by the test
   and not immediately accessible). This would be easy, if we temporarily
   could patch nmc_print*() to also log to nm_utils_print(). The new macros
   will allow doing that at one place.

For example, patch the "#if 0" and run:

  $ LIBNM_CLIENT_DEBUG=trace \
    LIBNM_CLIENT_DEBUG_FILE='xxx.%p' \
    NMTST_USE_VALGRIND=1 \
    LIBTOOL="/bin/sh ./libtool"
    ./src/tests/client/test-client.sh -- -k monitor
2023-02-08 10:11:17 +01:00
..
agent.c format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
common.c nmcli/trivial: rename nmc_print() to nmc_print_table() 2023-02-08 10:11:16 +01:00
common.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
connections.c nmcli/trivial: rename nmc_print() to nmc_print_table() 2023-02-08 10:11:16 +01:00
connections.h nmcli/trivial: rename monitor functions in internal header file 2023-02-08 10:11:15 +01:00
devices.c nmcli/trivial: rename nmc_print() to nmc_print_table() 2023-02-08 10:11:16 +01:00
devices.h nmcli/trivial: rename monitor functions in internal header file 2023-02-08 10:11:15 +01:00
gen-metadata-nm-settings-nmcli.c nmcli: rename "generate-docs-nm-settings-nmcli" to "gen-metadata-nm-settings-nmcli" 2022-10-31 09:11:30 +01:00
gen-metadata-nm-settings-nmcli.xml.in all: add support for ovs-dpdk n-rxq-desc and n-txq-desc 2023-01-17 08:45:04 +01:00
general.c nmcli/trivial: rename nmc_print() to nmc_print_table() 2023-02-08 10:11:16 +01:00
meson.build nmcli: rename "generate-docs-nm-settings-nmcli" to "gen-metadata-nm-settings-nmcli" 2022-10-31 09:11:30 +01:00
nmcli-completion nmcli-completion: fix support for embedded quote characters 2022-08-04 08:59:01 +02:00
nmcli.c nmcli: add --offline option for "add" and "modify" 2022-04-19 14:12:42 +02:00
nmcli.h cli: reformat file to look better 2022-06-16 11:02:20 +02:00
polkit-agent.c format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
polkit-agent.h cli: move from "clients/cli/" to "src/nmcli/" 2021-03-15 17:10:54 +01:00
README.md all: add some README.md files describing the purpose of our sources 2021-08-19 17:51:11 +02:00
settings.c nmcli/trivial: rename nmc_print() to nmc_print_table() 2023-02-08 10:11:16 +01:00
settings.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
utils.c nmcli/trivial: rename nmc_print() to nmc_print_table() 2023-02-08 10:11:16 +01:00
utils.h nmcli: add nmc_print()/nmc_printerr() macros 2023-02-08 10:11:17 +01:00

nmcli

The command line user interface of NetworkManager. It uses the D-Bus API of NetworkManager (via libnm).

See:

  • man 1 nmcli ([www])
  • man 7 nmcli-examples ([www])
  • man 5 nm-settings-nmcli ([www])

Try also with bash-completion!