diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-02-14 22:59:54 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-02-15 11:50:07 +0100 |
commit | 0e8901fbd162240c4ef533724c2b97f76ee3f1a7 (patch) | |
tree | 2b783e1493a35515157df7c069b1a400f14ebb49 | |
parent | 83ff4f819faf90bdd19dd03a338205c91fc42f6e (diff) | |
download | NetworkManager-0e8901fbd162240c4ef533724c2b97f76ee3f1a7.tar.gz |
core: report which option is unknown
So far NetworkManager didn't tell which option it didn't know about:
Invalid option. Please use --help to see a list of valid options.
Now it is a bit more informative:
Unknown option --asdf. Please use --help to see a list of valid options.
The "Unknown option" string is marked as translatable in glib so i18n
doesn't suffer.
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c index 1ea22743c9..44222404a9 100644 --- a/src/main.c +++ b/src/main.c @@ -391,11 +391,13 @@ main (int argc, char *argv[]) g_option_context_set_summary (opt_ctx, _("NetworkManager monitors all network connections and automatically\nchooses the best connection to use. It also allows the user to\nspecify wireless access points which wireless cards in the computer\nshould associate with.")); - success = g_option_context_parse (opt_ctx, &argc, &argv, NULL); + success = g_option_context_parse (opt_ctx, &argc, &argv, &error); g_option_context_free (opt_ctx); if (!success) { - fprintf (stderr, _("Invalid option. Please use --help to see a list of valid options.\n")); + fprintf (stderr, _("%s. Please use --help to see a list of valid options.\n"), + error->message); + g_clear_error (&error); exit (1); } |