Skip to content

Commit 2d36c6f

Browse files
committed
Make --print and --startup_notification appear in --help output
Calls to `cmdline_get_*` also modify the usage string. When the entries for help are not the last to set up all command line arguments set up afterwards don't show up in the usage.
1 parent c8982be commit 2d36c6f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/dunst.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,18 @@ int dunst_main(int argc, char *argv[])
179179
"Path to configuration file");
180180
load_settings(cmdline_config_path);
181181

182-
if (cmdline_get_bool("-h/-help/--help", false, "Print help")) {
183-
usage(EXIT_SUCCESS);
184-
}
185-
186182
if (cmdline_get_bool("-print/--print", false, "Print notifications to stdout")) {
187183
settings.print_notifications = true;
188184
}
189185

190186
settings.startup_notification = cmdline_get_bool("--startup_notification",
191187
0, "Display a notification on startup.");
192188

189+
/* Help should always be the last to set up as calls to cmdline_get_* (as a side effect) add entries to the usage list. */
190+
if (cmdline_get_bool("-h/-help/--help", false, "Print help")) {
191+
usage(EXIT_SUCCESS);
192+
}
193+
193194
int dbus_owner_id = dbus_init();
194195

195196
mainloop = g_main_loop_new(NULL, FALSE);

0 commit comments

Comments
 (0)