mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 07:51:28 +00:00
swaymsg: Print usage and exit on unknown options
This commit is contained in:
parent
b235ccd212
commit
0d55d1a067
|
@ -30,6 +30,14 @@ int main(int argc, char **argv) {
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char *usage =
|
||||||
|
"Usage: swaymsg [options] [message]\n"
|
||||||
|
"\n"
|
||||||
|
" -q, --quiet Be quiet.\n"
|
||||||
|
" -v, --version Show the version number and quit.\n"
|
||||||
|
" -s, --socket <socket> Use the specified socket.\n"
|
||||||
|
" -t, --type <type> Specify the message type.\n";
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while (1) {
|
while (1) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
@ -54,6 +62,9 @@ int main(int argc, char **argv) {
|
||||||
#endif
|
#endif
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "%s", usage);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue