mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 20:44:01 +01:00
sway: Print usage and exit on unknown options
This commit is contained in:
parent
3ba33321de
commit
e48a16ce5e
15
sway/main.c
15
sway/main.c
@ -65,6 +65,18 @@ int main(int argc, char **argv) {
|
||||
};
|
||||
|
||||
char *config_path = NULL;
|
||||
|
||||
const char* usage =
|
||||
"Usage: sway [options] [command]\n"
|
||||
"\n"
|
||||
" -c, --config <config> Specify a config file.\n"
|
||||
" -C, --validate Check the validity of the config file, then exit.\n"
|
||||
" -d, --debug Enables full logging, including debug information.\n"
|
||||
" -v, --version Show the version number and quit.\n"
|
||||
" -V, --verbose Enables more verbose logging.\n"
|
||||
" --get-socketpath Gets the IPC socket path and prints it, then exits.\n"
|
||||
"\n";
|
||||
|
||||
int c;
|
||||
while (1) {
|
||||
int option_index = 0;
|
||||
@ -104,6 +116,9 @@ int main(int argc, char **argv) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s", usage);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user