swaygrab: Add --help option that prints usage

This commit is contained in:
Christoph Gysin 2015-11-28 16:18:54 +02:00
parent 2f2e1f3fc7
commit 12c8cf5bf6
2 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,9 @@ ImageMagick convert for processing.
Options
-------
*-h, --help*::
Show help message and quit.
*-c, \--capture*::
Captures multiple frames as video and passes them into ffmpeg. Continues until
you send SIGTERM (ctrl+c) to swaygrab.

View File

@ -127,6 +127,7 @@ int main(int argc, char **argv) {
init_log(L_INFO);
static struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
{"capture", no_argument, &capture, 'c'},
{"version", no_argument, NULL, 'v'},
{"socket", required_argument, NULL, 's'},
@ -138,6 +139,7 @@ int main(int argc, char **argv) {
const char *usage =
"Usage: swaygrab [options] <output> [file]\n"
"\n"
" -h, --help Show help message and quit.\n"
" -c, --capture Capture video.\n"
" -v, --version Show the version number and quit.\n"
" -s, --socket <socket> Use the specified socket.\n"
@ -147,7 +149,7 @@ int main(int argc, char **argv) {
int c;
while (1) {
int option_index = 0;
c = getopt_long(argc, argv, "cvs:r", long_options, &option_index);
c = getopt_long(argc, argv, "hcvs:r", long_options, &option_index);
if (c == -1) {
break;
}