forked from speedie/spmenu
Add -fl argument which can be used to check if a feature is supported
This could be very useful for shell scripts, or debugging.
This commit is contained in:
parent
35d2f721a4
commit
1c6bc9f92d
|
@ -368,6 +368,9 @@ You may use long, descriptive arguments or the shorter arguments.
|
||||||
`-rv, --raw-version`
|
`-rv, --raw-version`
|
||||||
: Print raw spmenu version number to stdout
|
: Print raw spmenu version number to stdout
|
||||||
|
|
||||||
|
`-fl, --feature-list`
|
||||||
|
: List the state of all features that can be toggled
|
||||||
|
|
||||||
`-fn, --font font`
|
`-fn, --font font`
|
||||||
: Set the spmenu font to font
|
: Set the spmenu font to font
|
||||||
|
|
||||||
|
|
42
libs/argv.c
42
libs/argv.c
|
@ -89,6 +89,9 @@ void readargs(int argc, char *argv[]) {
|
||||||
if (!strcmp(argv[i], "-v") || (!strcmp(argv[i], "--version"))) { // prints version information
|
if (!strcmp(argv[i], "-v") || (!strcmp(argv[i], "--version"))) { // prints version information
|
||||||
puts("spmenu-"VERSION);
|
puts("spmenu-"VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
} else if (!strcmp(argv[i], "-fl") || (!strcmp(argv[i], "--feature-list"))) { // feature list
|
||||||
|
comp_opts();
|
||||||
|
exit(0);
|
||||||
} else if (!strcmp(argv[i], "-rv") || (!strcmp(argv[i], "--raw-version"))) { // help
|
} else if (!strcmp(argv[i], "-rv") || (!strcmp(argv[i], "--raw-version"))) { // help
|
||||||
puts(VERSION);
|
puts(VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -524,6 +527,44 @@ void readargs(int argc, char *argv[]) {
|
||||||
insert(input, strlen(input));
|
insert(input, strlen(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void comp_opts(void) {
|
||||||
|
#if USEWAYLAND
|
||||||
|
fprintf(stdout, "Wayland: Supported\n");
|
||||||
|
#else
|
||||||
|
fprintf(stdout, "Wayland: Unsupported\n");
|
||||||
|
#endif
|
||||||
|
#if USEX
|
||||||
|
fprintf(stdout, "X11: Supported\n");
|
||||||
|
#else
|
||||||
|
fprintf(stdout, "X11: Unsupported\n");
|
||||||
|
#endif
|
||||||
|
#if USERTL
|
||||||
|
fprintf(stdout, "RTL: Supported\n");
|
||||||
|
#else
|
||||||
|
fprintf(stdout, "RTL: Unsupported\n");
|
||||||
|
#endif
|
||||||
|
#if USEIMAGE
|
||||||
|
fprintf(stdout, "Images: Supported\n");
|
||||||
|
#else
|
||||||
|
fprintf(stdout, "Images: Unsupported\n");
|
||||||
|
#endif
|
||||||
|
#if USEXINERAMA
|
||||||
|
fprintf(stdout, "Xinerama: Supported\n");
|
||||||
|
#else
|
||||||
|
fprintf(stdout, "Xinerama: Unsupported\n");
|
||||||
|
#endif
|
||||||
|
#if USECONFIG
|
||||||
|
fprintf(stdout, "Config: Supported\n");
|
||||||
|
#else
|
||||||
|
fprintf(stdout, "Config: Unsupported\n");
|
||||||
|
#endif
|
||||||
|
#if USEXRESOURCES
|
||||||
|
fprintf(stdout, "xrdb: Supported\n");
|
||||||
|
#else
|
||||||
|
fprintf(stdout, "xrdb: Unsupported\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void usage(int status) {
|
void usage(int status) {
|
||||||
// print help
|
// print help
|
||||||
fputs("spmenu ", status ? stderr : stdout);
|
fputs("spmenu ", status ? stderr : stdout);
|
||||||
|
@ -659,6 +700,7 @@ void usage(int status) {
|
||||||
"spmenu -wl, --wayland Run spmenu in Wayland mode\n"
|
"spmenu -wl, --wayland Run spmenu in Wayland mode\n"
|
||||||
"spmenu -rv, --raw-version Print spmenu version number to stdout\n"
|
"spmenu -rv, --raw-version Print spmenu version number to stdout\n"
|
||||||
"spmenu -v, --version Print spmenu version to stdout\n"
|
"spmenu -v, --version Print spmenu version to stdout\n"
|
||||||
|
"spmenu -fl, --feature-list List the state of all features that can be toggled\n"
|
||||||
"\n", status ? stderr : stdout);
|
"\n", status ? stderr : stdout);
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
static void readargs(int argc, char *argv[]);
|
static void readargs(int argc, char *argv[]);
|
||||||
static void usage(int status);
|
static void usage(int status);
|
||||||
|
static void comp_opts(void);
|
||||||
|
|
3
spmenu.1
3
spmenu.1
|
@ -396,6 +396,9 @@ Print spmenu version to stdout
|
||||||
\f[V]-rv, --raw-version\f[R]
|
\f[V]-rv, --raw-version\f[R]
|
||||||
Print raw spmenu version number to stdout
|
Print raw spmenu version number to stdout
|
||||||
.TP
|
.TP
|
||||||
|
\f[V]-fl, --feature-list\f[R]
|
||||||
|
List the state of all features that can be toggled
|
||||||
|
.TP
|
||||||
\f[V]-fn, --font font\f[R]
|
\f[V]-fn, --font font\f[R]
|
||||||
Set the spmenu font to font
|
Set the spmenu font to font
|
||||||
.TP
|
.TP
|
||||||
|
|
Loading…
Reference in a new issue