diff options
author | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-28 16:18:54 +0200 |
---|---|---|
committer | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-28 23:50:44 +0200 |
commit | 12c8cf5bf6dd0d0e77ff78260b603cdaa1731a65 (patch) | |
tree | 07ebb7a69fe52870adf2181c31fe3dc764a0eea7 | |
parent | sway: Add --help option that prints usage (diff) | |
download | sway-12c8cf5bf6dd0d0e77ff78260b603cdaa1731a65.tar.gz sway-12c8cf5bf6dd0d0e77ff78260b603cdaa1731a65.tar.zst sway-12c8cf5bf6dd0d0e77ff78260b603cdaa1731a65.zip |
swaygrab: Add --help option that prints usage
-rw-r--r-- | swaygrab.1.txt | 3 | ||||
-rw-r--r-- | swaygrab/main.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/swaygrab.1.txt b/swaygrab.1.txt index 009fbe7e..cd4b8bd2 100644 --- a/swaygrab.1.txt +++ b/swaygrab.1.txt | |||
@@ -20,6 +20,9 @@ ImageMagick convert for processing. | |||
20 | Options | 20 | Options |
21 | ------- | 21 | ------- |
22 | 22 | ||
23 | *-h, --help*:: | ||
24 | Show help message and quit. | ||
25 | |||
23 | *-c, \--capture*:: | 26 | *-c, \--capture*:: |
24 | Captures multiple frames as video and passes them into ffmpeg. Continues until | 27 | Captures multiple frames as video and passes them into ffmpeg. Continues until |
25 | you send SIGTERM (ctrl+c) to swaygrab. | 28 | you send SIGTERM (ctrl+c) to swaygrab. |
diff --git a/swaygrab/main.c b/swaygrab/main.c index 90d118e2..ae17155f 100644 --- a/swaygrab/main.c +++ b/swaygrab/main.c | |||
@@ -127,6 +127,7 @@ int main(int argc, char **argv) { | |||
127 | init_log(L_INFO); | 127 | init_log(L_INFO); |
128 | 128 | ||
129 | static struct option long_options[] = { | 129 | static struct option long_options[] = { |
130 | {"help", no_argument, NULL, 'h'}, | ||
130 | {"capture", no_argument, &capture, 'c'}, | 131 | {"capture", no_argument, &capture, 'c'}, |
131 | {"version", no_argument, NULL, 'v'}, | 132 | {"version", no_argument, NULL, 'v'}, |
132 | {"socket", required_argument, NULL, 's'}, | 133 | {"socket", required_argument, NULL, 's'}, |
@@ -138,6 +139,7 @@ int main(int argc, char **argv) { | |||
138 | const char *usage = | 139 | const char *usage = |
139 | "Usage: swaygrab [options] <output> [file]\n" | 140 | "Usage: swaygrab [options] <output> [file]\n" |
140 | "\n" | 141 | "\n" |
142 | " -h, --help Show help message and quit.\n" | ||
141 | " -c, --capture Capture video.\n" | 143 | " -c, --capture Capture video.\n" |
142 | " -v, --version Show the version number and quit.\n" | 144 | " -v, --version Show the version number and quit.\n" |
143 | " -s, --socket <socket> Use the specified socket.\n" | 145 | " -s, --socket <socket> Use the specified socket.\n" |
@@ -147,7 +149,7 @@ int main(int argc, char **argv) { | |||
147 | int c; | 149 | int c; |
148 | while (1) { | 150 | while (1) { |
149 | int option_index = 0; | 151 | int option_index = 0; |
150 | c = getopt_long(argc, argv, "cvs:r", long_options, &option_index); | 152 | c = getopt_long(argc, argv, "hcvs:r", long_options, &option_index); |
151 | if (c == -1) { | 153 | if (c == -1) { |
152 | break; | 154 | break; |
153 | } | 155 | } |