aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Christoph Gysin <christoph.gysin@gmail.com>2015-11-28 16:18:46 +0200
committerLibravatar Christoph Gysin <christoph.gysin@gmail.com>2015-11-28 23:50:44 +0200
commitbf97a5ada5ea4f8b45d15d00dc7f21487af8eadc (patch)
tree5227d68b8173b7a4e747c602741ecfcf653c5fde
parentswaygrab: Add --help option that prints usage (diff)
downloadsway-bf97a5ada5ea4f8b45d15d00dc7f21487af8eadc.tar.gz
sway-bf97a5ada5ea4f8b45d15d00dc7f21487af8eadc.tar.zst
sway-bf97a5ada5ea4f8b45d15d00dc7f21487af8eadc.zip
swaymsg: Add --help option that prints usage
-rw-r--r--swaymsg.1.txt3
-rw-r--r--swaymsg/main.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/swaymsg.1.txt b/swaymsg.1.txt
index d832dd17..984780fa 100644
--- a/swaymsg.1.txt
+++ b/swaymsg.1.txt
@@ -17,6 +17,9 @@ Synopsis
17Options 17Options
18------- 18-------
19 19
20*-h, --help*::
21 Show help message and quit.
22
20*-q, \--quiet*:: 23*-q, \--quiet*::
21 Sends the IPC message but does not print the response from sway. 24 Sends the IPC message but does not print the response from sway.
22 25
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 }