diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c
index 43b1ae9b42..f3dc825d8c 100644
--- a/clients/cli/nmcli.c
+++ b/clients/cli/nmcli.c
@@ -601,11 +601,12 @@ main (int argc, char *argv[])
loop = g_main_loop_new (NULL, FALSE); /* create main loop */
g_main_loop_run (loop); /* run main loop */
- if (nm_cli.complete)
- nm_cli.return_value = NMC_RESULT_SUCCESS;
-
- /* Print result descripting text */
- if (nm_cli.return_value != NMC_RESULT_SUCCESS) {
+ if (nm_cli.complete) {
+ /* Remove error statuses from command completion runs. */
+ if (nm_cli.return_value < NMC_RESULT_COMPLETE_FILE)
+ nm_cli.return_value = NMC_RESULT_SUCCESS;
+ } else if (nm_cli.return_value != NMC_RESULT_SUCCESS) {
+ /* Print result descripting text */
g_printerr ("%s\n", nm_cli.return_text->str);
}
diff --git a/clients/cli/nmcli.h b/clients/cli/nmcli.h
index c867ad5f9f..a8908685bd 100644
--- a/clients/cli/nmcli.h
+++ b/clients/cli/nmcli.h
@@ -63,7 +63,10 @@ typedef enum {
NMC_RESULT_ERROR_VERSIONS_MISMATCH = 9,
/* Connection/Device/AP not found */
- NMC_RESULT_ERROR_NOT_FOUND = 10
+ NMC_RESULT_ERROR_NOT_FOUND = 10,
+
+ /* --complete-args signals a file name may follow */
+ NMC_RESULT_COMPLETE_FILE = 65,
} NMCResultCode;
typedef enum {
diff --git a/man/nmcli.xml b/man/nmcli.xml
index 0d403202f4..739efa9ce9 100644
--- a/man/nmcli.xml
+++ b/man/nmcli.xml
@@ -2089,6 +2089,13 @@ It's equivalent of using +ipv6.addresses syntax.
Connection, device, or access point does not exist.
+
+
+ 65
+
+ When used with option, a file name is expected to follow.
+
+