Skip to content

Commit 8b21816

Browse files
committed
Fix dunstify argparsing
1 parent 7f85725 commit 8b21816

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

dunstify.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ void parse_commandline(int argc, char *argv[])
121121

122122
g_option_context_free(context);
123123

124+
if (capabilities) {
125+
print_capabilities();
126+
die(0);
127+
}
128+
129+
if (serverinfo) {
130+
print_serverinfo();
131+
die(0);
132+
}
133+
124134
if (*appname == '\0') {
125135
g_printerr("Provided appname was empty\n");
126136
die(1);
@@ -139,7 +149,7 @@ void parse_commandline(int argc, char *argv[])
139149
}
140150
}
141151

142-
if (summary == NULL) {
152+
if (summary == NULL && close_id < 1) {
143153
g_printerr("I need at least a summary\n");
144154
die(1);
145155
}
@@ -242,7 +252,6 @@ void add_hint(NotifyNotification *n, char *str)
242252
notify_notification_set_hint_byte(n, name, (guchar) h_byte);
243253
} else
244254
g_printerr("Malformed hint. Expected a type of int, double, string or byte, got %s\n", type);
245-
246255
}
247256

248257
int main(int argc, char *argv[])
@@ -254,19 +263,8 @@ int main(int argc, char *argv[])
254263
g_type_init();
255264
#endif
256265

257-
if (capabilities) {
258-
print_capabilities();
259-
die(0);
260-
}
261-
262-
if (serverinfo) {
263-
print_serverinfo();
264-
die(0);
265-
}
266-
267266
parse_commandline(argc, argv);
268267

269-
270268
if (!notify_init(appname)) {
271269
g_printerr("Unable to initialize libnotify\n");
272270
die(1);

0 commit comments

Comments
 (0)