Move usage() to argv.c

This commit is contained in:
speedie 2023-03-02 18:17:11 +01:00
parent 3222648096
commit 1bdac1fadc
3 changed files with 110 additions and 109 deletions

View file

@ -237,3 +237,112 @@ readargs(int argc, char *argv[])
else else
usage(); usage();
} }
void
usage(void)
{
fputs("spmenu: dynamic menu\n\n"
"- Arguments -\n"
"spmenu -l <line> Set line count to stdin\n"
"spmenu -h <height> Set spmenu line height to <height>\n"
"spmenu -g <grid> Set the number of grids to <grid>\n"
"spmenu -gc Generate image cache\n"
"spmenu -rw Enable relative input width\n"
"spmenu -nrw Disable relative input width\n"
"spmenu -f Grabs keyboard before reading stdin\n"
"spmenu -F Enable fuzzy matching\n"
"spmenu -P Hide characters\n"
"spmenu -p <text> Set spmenu prompt text to <text>\n"
"spmenu -a Enable alpha\n"
"spmenu -na Disable alpha\n"
"spmenu -cp Color prompt\n"
"spmenu -ncp Don't color prompt\n"
"spmenu -tp Allow the user to type\n"
"spmenu -nt Don't allow typing, the user must select an option\n"
"spmenu -x <x offset> Offset spmenu x position by <x offset>\n"
"spmenu -y <y offset> Offset spmenu y position by <y offset>\n"
"spmenu -n <line> Preselect <line> in the list of items\n"
"spmenu -z <width> Width of the spmenu window\n"
"spmenu -nmt <text> Set normal mode text to <text>\n"
"spmenu -imt <text> Set insert mode text to <text>\n"
"spmenu -bw Width of the border. 0 will disable the border\n"
"spmenu -s Use case-sensitive matching\n"
"spmenu -i Use case-insensitive matching\n"
"spmenu -nm Start spmenu in normal mode\n"
"spmenu -im Start spmenu in insert mode\n"
"spmenu -t Position spmenu at the top of the screen\n"
"spmenu -b Position spmenu at the bottom of the screen\n"
"spmenu -c Position spmenu at the center of the screen\n"
"spmenu -hm Hide mode indicator\n"
"spmenu -hmc Hide match count\n"
"spmenu -sm Show mode indicator\n"
"spmenu -smc Show match count\n"
"spmenu -xrdb Load .Xresources on runtime\n"
"spmenu -nxrdb Don't load .Xresources on runtime\n"
"spmenu -m <monitor> Specify a monitor to run spmenu on\n"
"spmenu -w <window id> Embed spmenu inside <window id>\n"
"spmenu -H <hist file> Specify a path to save the history to\n"
"spmenu -ig <gaps> Set image gaps to <gaps>\n"
"spmenu -lp <padding> Set the vertical padding\n"
"spmenu -hp <padding> Set the horizontal padding\n"
"spmenu -la <symbol> Set the left arrow to <symbol>\n"
"spmenu -ra <symbol> Set the right arrow to <symbol>\n"
"spmenu -is <size> Image size\n"
"spmenu -it Position the image at the top\n"
"spmenu -ib Position the image at the bottom\n"
"spmenu -ic Position the image in the center\n"
"spmenu -itc Position the image in the top center\n"
"spmenu -wm Spawn spmenu as a window manager controlled client/window. Useful for testing\n"
"spmenu -v Print spmenu version to stdout\n"
"\n", stdout);
fputs("- Appearance arguments -\n"
"spmenu -fn <font> Set the spmenu font to <font>\n"
"spmenu -nif <color> Set the normal item foreground color\n"
"spmenu -nib <color> Set the normal item background color\n"
"spmenu -sif <color> Set the selected item foreground color\n"
"spmenu -sib <color> Set the selected item background color\n"
"spmenu -pfg <color> Set the prompt foreground color\n"
"spmenu -pbg <color> Set the prompt background color\n"
"spmenu -ifg <color> Set input foreground color\n"
"spmenu -ibg <color> Set input background color\n"
"spmenu -mbg <color> Set the menu background color\n"
"spmenu -nhf <color> Set the normal highlight foreground color\n"
"spmenu -nhb <color> Set the normal highlight background color\n"
"spmenu -shf <color> Set the selected highlight foreground color\n"
"spmenu -shb <color> Set the selected highlight background color\n"
"spmenu -shb <color> Set the selected highlight background color\n"
"spmenu -nfg <color> Set the foreground color for the match count\n"
"spmenu -nbg <color> Set the background color for the match count\n"
"spmenu -mfg <color> Set the foreground color for the mode indicator\n"
"spmenu -mbg <color> Set the background color for the mode indicator\n"
"spmenu -laf <color> Set the left arrow foreground color\n"
"spmenu -raf <color> Set the right arrow foreground color\n"
"spmenu -lab <color> Set the left arrow background color\n"
"spmenu -rab <color> Set the right arrow background color\n"
"spmenu -cc <color> Set the caret color\n"
"spmenu -bc <color> Set the border color\n"
"spmenu -sgr0 Set the SGR 0 color\n"
"spmenu -sgr1 Set the SGR 1 color\n"
"spmenu -sgr2 Set the SGR 2 color\n"
"spmenu -sgr3 Set the SGR 3 color\n"
"spmenu -sgr4 Set the SGR 4 color\n"
"spmenu -sgr5 Set the SGR 5 color\n"
"spmenu -sgr6 Set the SGR 6 color\n"
"spmenu -sgr7 Set the SGR 7 color\n"
"spmenu -sgr8 Set the SGR 8 color\n"
"spmenu -sgr9 Set the SGR 9 color\n"
"spmenu -sgr10 Set the SGR 10 color\n"
"spmenu -sgr11 Set the SGR 11 color\n"
"spmenu -sgr12 Set the SGR 12 color\n"
"spmenu -sgr13 Set the SGR 13 color\n"
"spmenu -sgr14 Set the SGR 14 color\n"
"spmenu -sgr15 Set the SGR 15 color\n"
"\n", stdout);
fputs("- dmenu compatibility -\n"
"spmenu -nb <color> Set the normal background color\n"
"spmenu -nf <color> Set the normal foreground color\n"
"spmenu -sb <color> Set the selected background color\n"
"spmenu -sf <color> Set the selected foreground color\n"
, stdout);
exit(1);
}

View file

@ -1 +1,2 @@
static void readargs(int argc, char *argv[]); static void readargs(int argc, char *argv[]);
static void usage(void);

109
spmenu.c
View file

@ -1458,115 +1458,6 @@ setup(void)
drawmenu(); drawmenu();
} }
void
usage(void)
{
fputs("spmenu: dynamic menu\n\n"
"- Arguments -\n"
"spmenu -l <line> Set line count to stdin\n"
"spmenu -h <height> Set spmenu line height to <height>\n"
"spmenu -g <grid> Set the number of grids to <grid>\n"
"spmenu -gc Generate image cache\n"
"spmenu -rw Enable relative input width\n"
"spmenu -nrw Disable relative input width\n"
"spmenu -f Grabs keyboard before reading stdin\n"
"spmenu -F Enable fuzzy matching\n"
"spmenu -P Hide characters\n"
"spmenu -p <text> Set spmenu prompt text to <text>\n"
"spmenu -a Enable alpha\n"
"spmenu -na Disable alpha\n"
"spmenu -cp Color prompt\n"
"spmenu -ncp Don't color prompt\n"
"spmenu -tp Allow the user to type\n"
"spmenu -nt Don't allow typing, the user must select an option\n"
"spmenu -x <x offset> Offset spmenu x position by <x offset>\n"
"spmenu -y <y offset> Offset spmenu y position by <y offset>\n"
"spmenu -n <line> Preselect <line> in the list of items\n"
"spmenu -z <width> Width of the spmenu window\n"
"spmenu -nmt <text> Set normal mode text to <text>\n"
"spmenu -imt <text> Set insert mode text to <text>\n"
"spmenu -bw Width of the border. 0 will disable the border\n"
"spmenu -s Use case-sensitive matching\n"
"spmenu -i Use case-insensitive matching\n"
"spmenu -nm Start spmenu in normal mode\n"
"spmenu -im Start spmenu in insert mode\n"
"spmenu -t Position spmenu at the top of the screen\n"
"spmenu -b Position spmenu at the bottom of the screen\n"
"spmenu -c Position spmenu at the center of the screen\n"
"spmenu -hm Hide mode indicator\n"
"spmenu -hmc Hide match count\n"
"spmenu -sm Show mode indicator\n"
"spmenu -smc Show match count\n"
"spmenu -xrdb Load .Xresources on runtime\n"
"spmenu -nxrdb Don't load .Xresources on runtime\n"
"spmenu -m <monitor> Specify a monitor to run spmenu on\n"
"spmenu -w <window id> Embed spmenu inside <window id>\n"
"spmenu -H <hist file> Specify a path to save the history to\n"
"spmenu -ig <gaps> Set image gaps to <gaps>\n"
"spmenu -lp <padding> Set the vertical padding\n"
"spmenu -hp <padding> Set the horizontal padding\n"
"spmenu -la <symbol> Set the left arrow to <symbol>\n"
"spmenu -ra <symbol> Set the right arrow to <symbol>\n"
"spmenu -is <size> Image size\n"
"spmenu -it Position the image at the top\n"
"spmenu -ib Position the image at the bottom\n"
"spmenu -ic Position the image in the center\n"
"spmenu -itc Position the image in the top center\n"
"spmenu -wm Spawn spmenu as a window manager controlled client/window. Useful for testing\n"
"spmenu -v Print spmenu version to stdout\n"
"\n", stdout);
fputs("- Appearance arguments -\n"
"spmenu -fn <font> Set the spmenu font to <font>\n"
"spmenu -nif <color> Set the normal item foreground color\n"
"spmenu -nib <color> Set the normal item background color\n"
"spmenu -sif <color> Set the selected item foreground color\n"
"spmenu -sib <color> Set the selected item background color\n"
"spmenu -pfg <color> Set the prompt foreground color\n"
"spmenu -pbg <color> Set the prompt background color\n"
"spmenu -ifg <color> Set input foreground color\n"
"spmenu -ibg <color> Set input background color\n"
"spmenu -mbg <color> Set the menu background color\n"
"spmenu -nhf <color> Set the normal highlight foreground color\n"
"spmenu -nhb <color> Set the normal highlight background color\n"
"spmenu -shf <color> Set the selected highlight foreground color\n"
"spmenu -shb <color> Set the selected highlight background color\n"
"spmenu -shb <color> Set the selected highlight background color\n"
"spmenu -nfg <color> Set the foreground color for the match count\n"
"spmenu -nbg <color> Set the background color for the match count\n"
"spmenu -mfg <color> Set the foreground color for the mode indicator\n"
"spmenu -mbg <color> Set the background color for the mode indicator\n"
"spmenu -laf <color> Set the left arrow foreground color\n"
"spmenu -raf <color> Set the right arrow foreground color\n"
"spmenu -lab <color> Set the left arrow background color\n"
"spmenu -rab <color> Set the right arrow background color\n"
"spmenu -cc <color> Set the caret color\n"
"spmenu -bc <color> Set the border color\n"
"spmenu -sgr0 Set the SGR 0 color\n"
"spmenu -sgr1 Set the SGR 1 color\n"
"spmenu -sgr2 Set the SGR 2 color\n"
"spmenu -sgr3 Set the SGR 3 color\n"
"spmenu -sgr4 Set the SGR 4 color\n"
"spmenu -sgr5 Set the SGR 5 color\n"
"spmenu -sgr6 Set the SGR 6 color\n"
"spmenu -sgr7 Set the SGR 7 color\n"
"spmenu -sgr8 Set the SGR 8 color\n"
"spmenu -sgr9 Set the SGR 9 color\n"
"spmenu -sgr10 Set the SGR 10 color\n"
"spmenu -sgr11 Set the SGR 11 color\n"
"spmenu -sgr12 Set the SGR 12 color\n"
"spmenu -sgr13 Set the SGR 13 color\n"
"spmenu -sgr14 Set the SGR 14 color\n"
"spmenu -sgr15 Set the SGR 15 color\n"
"\n", stdout);
fputs("- dmenu compatibility -\n"
"spmenu -nb <color> Set the normal background color\n"
"spmenu -nf <color> Set the normal foreground color\n"
"spmenu -sb <color> Set the selected background color\n"
"spmenu -sf <color> Set the selected foreground color\n"
, stdout);
exit(1);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {