diff options
author | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-28 16:18:46 +0200 |
---|---|---|
committer | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-28 23:50:44 +0200 |
commit | bf97a5ada5ea4f8b45d15d00dc7f21487af8eadc (patch) | |
tree | 5227d68b8173b7a4e747c602741ecfcf653c5fde /swaymsg/main.c | |
parent | swaygrab: Add --help option that prints usage (diff) | |
download | sway-bf97a5ada5ea4f8b45d15d00dc7f21487af8eadc.tar.gz sway-bf97a5ada5ea4f8b45d15d00dc7f21487af8eadc.tar.zst sway-bf97a5ada5ea4f8b45d15d00dc7f21487af8eadc.zip |
swaymsg: Add --help option that prints usage
Diffstat (limited to 'swaymsg/main.c')
-rw-r--r-- | swaymsg/main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c index 2f2e843a..8f91dc55 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -23,6 +23,7 @@ int main(int argc, char **argv) { | |||
23 | init_log(L_INFO); | 23 | init_log(L_INFO); |
24 | 24 | ||
25 | static struct option long_options[] = { | 25 | static struct option long_options[] = { |
26 | {"help", no_argument, NULL, 'h'}, | ||
26 | {"quiet", no_argument, &quiet, 'q'}, | 27 | {"quiet", no_argument, &quiet, 'q'}, |
27 | {"version", no_argument, NULL, 'v'}, | 28 | {"version", no_argument, NULL, 'v'}, |
28 | {"socket", required_argument, NULL, 's'}, | 29 | {"socket", required_argument, NULL, 's'}, |
@@ -33,6 +34,7 @@ int main(int argc, char **argv) { | |||
33 | const char *usage = | 34 | const char *usage = |
34 | "Usage: swaymsg [options] [message]\n" | 35 | "Usage: swaymsg [options] [message]\n" |
35 | "\n" | 36 | "\n" |
37 | " -h, --help Show help message and quit.\n" | ||
36 | " -q, --quiet Be quiet.\n" | 38 | " -q, --quiet Be quiet.\n" |
37 | " -v, --version Show the version number and quit.\n" | 39 | " -v, --version Show the version number and quit.\n" |
38 | " -s, --socket <socket> Use the specified socket.\n" | 40 | " -s, --socket <socket> Use the specified socket.\n" |
@@ -41,7 +43,7 @@ int main(int argc, char **argv) { | |||
41 | int c; | 43 | int c; |
42 | while (1) { | 44 | while (1) { |
43 | int option_index = 0; | 45 | int option_index = 0; |
44 | c = getopt_long(argc, argv, "qvs:t:", long_options, &option_index); | 46 | c = getopt_long(argc, argv, "hqvs:t:", long_options, &option_index); |
45 | if (c == -1) { | 47 | if (c == -1) { |
46 | break; | 48 | break; |
47 | } | 49 | } |