diff options
Diffstat (limited to 'swaybar/main.c')
-rw-r--r-- | swaybar/main.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/swaybar/main.c b/swaybar/main.c index 66077592..a3a3b56a 100644 --- a/swaybar/main.c +++ b/swaybar/main.c | |||
@@ -1191,6 +1191,7 @@ int main(int argc, char **argv) { | |||
1191 | bool debug = false; | 1191 | bool debug = false; |
1192 | 1192 | ||
1193 | static struct option long_options[] = { | 1193 | static struct option long_options[] = { |
1194 | {"help", no_argument, NULL, 'h'}, | ||
1194 | {"version", no_argument, NULL, 'v'}, | 1195 | {"version", no_argument, NULL, 'v'}, |
1195 | {"socket", required_argument, NULL, 's'}, | 1196 | {"socket", required_argument, NULL, 's'}, |
1196 | {"bar_id", required_argument, NULL, 'b'}, | 1197 | {"bar_id", required_argument, NULL, 'b'}, |
@@ -1198,10 +1199,23 @@ int main(int argc, char **argv) { | |||
1198 | {0, 0, 0, 0} | 1199 | {0, 0, 0, 0} |
1199 | }; | 1200 | }; |
1200 | 1201 | ||
1202 | const char *usage = | ||
1203 | "Usage: swaybar [options...] <output>\n" | ||
1204 | "\n" | ||
1205 | " -h, --help Show help message and quit.\n" | ||
1206 | " -v, --version Show the version number and quit.\n" | ||
1207 | " -s, --socket <socket> Connect to sway via socket.\n" | ||
1208 | " -b, --bar_id <id> Bar ID for which to get the configuration.\n" | ||
1209 | " -d, --debug Enable debugging.\n" | ||
1210 | "\n" | ||
1211 | " PLEASE NOTE that swaybar will be automatically started by sway as\n" | ||
1212 | " soon as there is a 'bar' configuration block in your config file.\n" | ||
1213 | " You should never need to start it manually.\n"; | ||
1214 | |||
1201 | int c; | 1215 | int c; |
1202 | while (1) { | 1216 | while (1) { |
1203 | int option_index = 0; | 1217 | int option_index = 0; |
1204 | c = getopt_long(argc, argv, "vs:b:d", long_options, &option_index); | 1218 | c = getopt_long(argc, argv, "hvs:b:d", long_options, &option_index); |
1205 | if (c == -1) { | 1219 | if (c == -1) { |
1206 | break; | 1220 | break; |
1207 | } | 1221 | } |
@@ -1224,6 +1238,7 @@ int main(int argc, char **argv) { | |||
1224 | debug = true; | 1238 | debug = true; |
1225 | break; | 1239 | break; |
1226 | default: | 1240 | default: |
1241 | fprintf(stderr, "%s", usage); | ||
1227 | exit(EXIT_FAILURE); | 1242 | exit(EXIT_FAILURE); |
1228 | } | 1243 | } |
1229 | } | 1244 | } |