mirror of
https://github.com/wizbright/waybox.git
synced 2026-03-03 01:40:58 -05:00
Openbox-esque help
This commit is contained in:
parent
81887c631c
commit
7bb4e79256
1 changed files with 31 additions and 8 deletions
|
|
@ -1,24 +1,38 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
|
||||||
#include "waybox/server.h"
|
#include "waybox/server.h"
|
||||||
|
|
||||||
|
bool show_help(char *name)
|
||||||
|
{
|
||||||
|
printf(_("Syntax: %s [options]\n"), name);
|
||||||
|
printf(_("\nOptions:\n"));
|
||||||
|
printf(_(" --help Display this help and exit\n"));
|
||||||
|
printf(_(" --version Display the version and exit\n"));
|
||||||
|
/* TRANSLATORS: If you translate FILE, be sure the text remains aligned. */
|
||||||
|
printf(_(" --config-file FILE Specify the path to the config file to use\n"));
|
||||||
|
printf(_(" --sm-disable Disable connection to the session manager\n"));
|
||||||
|
printf(_(" --startup CMD Run CMD after starting\n"));
|
||||||
|
printf(_(" --debug Display debugging output\n"));
|
||||||
|
printf(_("\nOther Openbox options aren't accepted, "
|
||||||
|
"mostly due to them being nonsensical on Wayland.\n"));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
textdomain(GETTEXT_PACKAGE);
|
setlocale(LC_ALL, "");
|
||||||
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
||||||
setlocale(LC_ALL, NULL);
|
textdomain(GETTEXT_PACKAGE);
|
||||||
|
|
||||||
char *startup_cmd = NULL;
|
char *startup_cmd = NULL;
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
if (argc > 0) {
|
if (argc > 1) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
if (!strcmp("--debug", argv[i]) || !strcmp("-v", argv[i])) {
|
if (!strcmp("--debug", argv[i]) || !strcmp("-v", argv[i])) {
|
||||||
debug = true;
|
debug = true;
|
||||||
} else if (!strcmp("--exit", argv[i])) {
|
|
||||||
fprintf(stderr, _("Warning: option %s is currently unimplemented\n"), argv[i]);
|
|
||||||
} else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i]))) {
|
} else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i]))) {
|
||||||
if (i < argc - 1) {
|
if (i < argc - 1) {
|
||||||
startup_cmd = argv[i + 1];
|
startup_cmd = argv[i + 1];
|
||||||
|
|
@ -28,9 +42,18 @@ int main(int argc, char **argv) {
|
||||||
} else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
|
} else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
|
||||||
printf(PACKAGE_NAME " " PACKAGE_VERSION "\n");
|
printf(PACKAGE_NAME " " PACKAGE_VERSION "\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (!strcmp("--help", argv[i]) || !strcmp("-h", argv[i])) {
|
||||||
|
show_help(argv[0]);
|
||||||
|
return 0;
|
||||||
|
} else if (!strcmp("--config-file", argv[i]) ||
|
||||||
|
!strcmp("--sm-disable", argv[i])) {
|
||||||
|
fprintf(stderr, _("Warning: option '%s' hasn't been implemented yet.\n"), argv[i]);
|
||||||
|
if (i == argc - 1) {
|
||||||
|
fprintf(stderr, _("%s requires an argument\n"), argv[i]);
|
||||||
|
}
|
||||||
} else if (argv[i][0] == '-') {
|
} else if (argv[i][0] == '-') {
|
||||||
printf(_("Usage: %s [--debug] [--exit] [--help] [--startup CMD] [--version]\n"), argv[0]);
|
show_help(argv[0]);
|
||||||
return strcmp("--help", argv[i]) != 0 && strcmp("-h", argv[i]) != 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue