diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2016-01-23 14:35:27 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2016-01-23 14:35:27 -0500 |
| commit | 34919f8c3215114a0a5fef512fb3be6f0d96c1fe (patch) | |
| tree | 3b5239943a68a0b74194aba4baa642236e54dc9e | |
| parent | af87679878b5b5683d4e4092b540b46ee9666e84 (diff) | |
| parent | 0e54005a30150a23ff12ded0c9c32539b3e9ad0c (diff) | |
Merge pull request #466 from christophgysin/swaybar_usage
swaybar: add usage
| -rw-r--r-- | swaybar/main.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/swaybar/main.c b/swaybar/main.c index 98b75aee..a3a3b56a 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -1191,17 +1191,31 @@ int main(int argc, char **argv) { bool debug = false; static struct option long_options[] = { + {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, {"socket", required_argument, NULL, 's'}, {"bar_id", required_argument, NULL, 'b'}, - {"debug", required_argument, NULL, 'd'}, + {"debug", no_argument, NULL, 'd'}, {0, 0, 0, 0} }; + const char *usage = + "Usage: swaybar [options...] <output>\n" + "\n" + " -h, --help Show help message and quit.\n" + " -v, --version Show the version number and quit.\n" + " -s, --socket <socket> Connect to sway via socket.\n" + " -b, --bar_id <id> Bar ID for which to get the configuration.\n" + " -d, --debug Enable debugging.\n" + "\n" + " PLEASE NOTE that swaybar will be automatically started by sway as\n" + " soon as there is a 'bar' configuration block in your config file.\n" + " You should never need to start it manually.\n"; + int c; while (1) { int option_index = 0; - c = getopt_long(argc, argv, "vs:b:d", long_options, &option_index); + c = getopt_long(argc, argv, "hvs:b:d", long_options, &option_index); if (c == -1) { break; } @@ -1224,6 +1238,7 @@ int main(int argc, char **argv) { debug = true; break; default: + fprintf(stderr, "%s", usage); exit(EXIT_FAILURE); } } |
