mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 09:21:28 +00:00
swaymsg: Add --help option that prints usage
This commit is contained in:
parent
12c8cf5bf6
commit
bf97a5ada5
|
@ -17,6 +17,9 @@ Synopsis
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
*-h, --help*::
|
||||||
|
Show help message and quit.
|
||||||
|
|
||||||
*-q, \--quiet*::
|
*-q, \--quiet*::
|
||||||
Sends the IPC message but does not print the response from sway.
|
Sends the IPC message but does not print the response from sway.
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ int main(int argc, char **argv) {
|
||||||
init_log(L_INFO);
|
init_log(L_INFO);
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
|
{"help", no_argument, NULL, 'h'},
|
||||||
{"quiet", no_argument, &quiet, 'q'},
|
{"quiet", no_argument, &quiet, 'q'},
|
||||||
{"version", no_argument, NULL, 'v'},
|
{"version", no_argument, NULL, 'v'},
|
||||||
{"socket", required_argument, NULL, 's'},
|
{"socket", required_argument, NULL, 's'},
|
||||||
|
@ -33,6 +34,7 @@ int main(int argc, char **argv) {
|
||||||
const char *usage =
|
const char *usage =
|
||||||
"Usage: swaymsg [options] [message]\n"
|
"Usage: swaymsg [options] [message]\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
" -h, --help Show help message and quit.\n"
|
||||||
" -q, --quiet Be quiet.\n"
|
" -q, --quiet Be quiet.\n"
|
||||||
" -v, --version Show the version number and quit.\n"
|
" -v, --version Show the version number and quit.\n"
|
||||||
" -s, --socket <socket> Use the specified socket.\n"
|
" -s, --socket <socket> Use the specified socket.\n"
|
||||||
|
@ -41,7 +43,7 @@ int main(int argc, char **argv) {
|
||||||
int c;
|
int c;
|
||||||
while (1) {
|
while (1) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
c = getopt_long(argc, argv, "qvs:t:", long_options, &option_index);
|
c = getopt_long(argc, argv, "hqvs:t:", long_options, &option_index);
|
||||||
if (c == -1) {
|
if (c == -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue