foot/footclient: add short options to all command line options

e813883367 added “missing” short command
line options to footclient.

Except they weren’t missing; they were intentionally missing short
options and only supported long options.

This commit makes the new/missing short options “official”, by adding
documentation, zsh completions and including them in usage().
This commit is contained in:
Daniel Eklöf 2020-11-23 19:19:19 +01:00
parent 9ab1235b97
commit 8eaa195990
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
6 changed files with 24 additions and 22 deletions

View file

@ -74,6 +74,8 @@ means foot can be PGO:d in e.g. sandboxed build scripts. See
scale factor alone (https://codeberg.org/dnkl/foot/issues/206). scale factor alone (https://codeberg.org/dnkl/foot/issues/206).
* `-w,--window-size-pixels` and `-W,--window-size-chars` command line * `-w,--window-size-pixels` and `-W,--window-size-chars` command line
options to `footclient` (https://codeberg.org/dnkl/foot/issues/189). options to `footclient` (https://codeberg.org/dnkl/foot/issues/189).
* Short command line options for `--title`, `--maximized`,
`--fullscreen`, `--login-shell`, `--hold` and `--check-config`.
### Changed ### Changed

View file

@ -3,18 +3,18 @@
_arguments \ _arguments \
-s -S -C \ -s -S -C \
'(-c --config)'{-c,--config}'[path to configuration file (XDG_CONFIG_HOME/footrc)]:config:_files' \ '(-c --config)'{-c,--config}'[path to configuration file (XDG_CONFIG_HOME/footrc)]:config:_files' \
'--check-config[verify configuration and exit with 0 if ok, otherwise exit with 1]' \ '(-C --check-config)'{-C,--check-config}'[verify configuration and exit with 0 if ok, otherwise exit with 1]' \
'(-f --font)'{-f,--font}'[font name and style in fontconfig format (monospace)]:font:->fonts' \ '(-f --font)'{-f,--font}'[font name and style in fontconfig format (monospace)]:font:->fonts' \
'(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \ '(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \
'--title[initial window title]:()' \ '(-T --title)'{-T,--title}'[initial window title]:()' \
'(-a --app-id)'{-a,--app-id}'[value to set the app-id property on the Wayland window to (foot)]:()' \ '(-a --app-id)'{-a,--app-id}'[value to set the app-id property on the Wayland window to (foot)]:()' \
'--maximized[start in maximized mode]' \ '(-m --maximized)'{-m,--maximized}'[start in maximized mode]' \
'--fullscreen[start in fullscreen mode]' \ '(-F --fullscreen)'{-F,--fullscreen}'[start in fullscreen mode]' \
'--login-shell[start shell as a login shell]' \ '(-L --login-shell)'{-L,--login-shell}'[start shell as a login shell]' \
'(-w --window-size-pixels)'{-w,--window-size-pixels}'[window WIDTHxHEIGHT, in pixels (700x500)]:size_pixels:()' \ '(-w --window-size-pixels)'{-w,--window-size-pixels}'[window WIDTHxHEIGHT, in pixels (700x500)]:size_pixels:()' \
'(-W --window-size-chars)'{-W,--window-size-chars}'[window WIDTHxHEIGHT, in characters (not set)]:size_chars:()' \ '(-W --window-size-chars)'{-W,--window-size-chars}'[window WIDTHxHEIGHT, in characters (not set)]:size_chars:()' \
'(-s --server)'{-s,--server}'[run as server; open terminals by running footclient]:server:_files' \ '(-s --server)'{-s,--server}'[run as server; open terminals by running footclient]:server:_files' \
'--hold[remain open after child process exits]' \ '(-H --hold)'{-H,--hold}'[remain open after child process exits]' \
'(-p --print-pid)'{-p,--print-pid}'[print PID to this file or FD when up and running (server mode only)]:pidfile:_files' \ '(-p --print-pid)'{-p,--print-pid}'[print PID to this file or FD when up and running (server mode only)]:pidfile:_files' \
'(-l --log-colorize)'{-l,--log-colorize}'[enable or disable colorization of log output on stderr]:logcolor:(never always auto)' \ '(-l --log-colorize)'{-l,--log-colorize}'[enable or disable colorization of log output on stderr]:logcolor:(never always auto)' \
'(-S --log-no-syslog)'{-s,--log-no-syslog}'[disable syslog logging (server mode only)]' \ '(-S --log-no-syslog)'{-s,--log-no-syslog}'[disable syslog logging (server mode only)]' \

View file

@ -3,15 +3,15 @@
_arguments \ _arguments \
-s -S -C \ -s -S -C \
'(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \ '(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \
'--title[initial window title]:()' \ '(-T --title)'{-T,--title}'[initial window title]:()' \
'(-a --app-id)'{-a,--app-id}'[value to set the app-id property on the Wayland window to (foot)]:()' \ '(-a --app-id)'{-a,--app-id}'[value to set the app-id property on the Wayland window to (foot)]:()' \
'--maximized[start in maximized mode]' \ '(-m --maximized)'{-m,--maximized}'[start in maximized mode]' \
'--fullscreen[start in fullscreen mode]' \ '(-F --fullscreen)'{-F,--fullscreen}'[start in fullscreen mode]' \
'--login-shell[start shell as a login shell]' \ '(-L --login-shell)'{-L,--login-shell}'[start shell as a login shell]' \
'(-w --window-size-pixels)'{-w,--window-size-pixels}'[window WIDTHxHEIGHT, in pixels (700x500)]:size_pixels:()' \ '(-w --window-size-pixels)'{-w,--window-size-pixels}'[window WIDTHxHEIGHT, in pixels (700x500)]:size_pixels:()' \
'(-W --window-size-chars)'{-W,--window-size-chars}'[window WIDTHxHEIGHT, in characters (not set)]:size_chars:()' \ '(-W --window-size-chars)'{-W,--window-size-chars}'[window WIDTHxHEIGHT, in characters (not set)]:size_chars:()' \
'(-s --server-socket)'{-s,--server-socket}'[override the default path to the foot server socket ($XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock)]:server:_files' \ '(-s --server-socket)'{-s,--server-socket}'[override the default path to the foot server socket ($XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock)]:server:_files' \
'--hold[remain open after child process exits]' \ '(-H --hold)'{-H,--hold}'[remain open after child process exits]' \
'(-l --log-colorize)'{-l,--log-colorize}'[enable or disable colorization of log output on stderr]:logcolor:(never always auto)' \ '(-l --log-colorize)'{-l,--log-colorize}'[enable or disable colorization of log output on stderr]:logcolor:(never always auto)' \
'(-v --version)'{-v,--version}'[show the version number and quit]' \ '(-v --version)'{-v,--version}'[show the version number and quit]' \
'(-h --help)'{-h,--help}'[show help message and quit]' \ '(-h --help)'{-h,--help}'[show help message and quit]' \

View file

@ -26,7 +26,7 @@ the foot command line
Path to configuration file. Default: Path to configuration file. Default:
*$XDG_CONFIG_HOME/foot/foot.ini*. *$XDG_CONFIG_HOME/foot/foot.ini*.
*--check-config* *-C*,*--check-config*
Verify configuration and then exit with 0 if ok, otherwise exit Verify configuration and then exit with 0 if ok, otherwise exit
with 1. with 1.
@ -57,18 +57,18 @@ the foot command line
*-t*,*--term*=_TERM_ *-t*,*--term*=_TERM_
Value to set the environment variable *TERM* to. Default: _foot_. Value to set the environment variable *TERM* to. Default: _foot_.
*--title*=_TITLE_ *-T*,*--title*=_TITLE_
Initial window title. Default: _foot_. Initial window title. Default: _foot_.
*-a*,*--app-id*=_ID_ *-a*,*--app-id*=_ID_
Value to set the *app-id* property on the Wayland window Value to set the *app-id* property on the Wayland window
to. Default: _foot_. to. Default: _foot_.
*--maximized* *-m*,*--maximized*
Start in maximized mode. If both *--maximized* and *--fullscreen* Start in maximized mode. If both *--maximized* and *--fullscreen*
are specified, the _last_ one takes precedence. are specified, the _last_ one takes precedence.
*--fullscreen* *-F*,*--fullscreen*
Start in fullscreen mode. If both *--maximized* and *--fullscreen* Start in fullscreen mode. If both *--maximized* and *--fullscreen*
are specified, the _last_ one takes precedence. are specified, the _last_ one takes precedence.
@ -110,7 +110,7 @@ the foot command line
*--server-socket* option in *footclient*(1) and point it to your *--server-socket* option in *footclient*(1) and point it to your
custom socket path. custom socket path.
*--hold* *-H*,*--hold*
Remain open after child process exits. Remain open after child process exits.
*-p*,*--print-pid*=_FILE_|_FD_ *-p*,*--print-pid*=_FILE_|_FD_

View file

@ -25,7 +25,7 @@ terminal has terminated).
*-t*,*--term*=_TERM_ *-t*,*--term*=_TERM_
Value to set the environment variable *TERM* to. Default: _foot_. Value to set the environment variable *TERM* to. Default: _foot_.
*--title*=_TITLE_ *-T*,*--title*=_TITLE_
Initial window title. Default: _foot_. Initial window title. Default: _foot_.
*-a*,*--app-id*=_ID_ *-a*,*--app-id*=_ID_
@ -38,22 +38,22 @@ terminal has terminated).
*-W*,*--window-size-chars*=_WIDTHxHEIGHT_ *-W*,*--window-size-chars*=_WIDTHxHEIGHT_
Set initial window width and height, in characters. Default: _not set_. Set initial window width and height, in characters. Default: _not set_.
*--maximized* *-m*,*--maximized*
Start in maximized mode. If both *--maximized* and *--fullscreen* Start in maximized mode. If both *--maximized* and *--fullscreen*
are specified, the _last_ one takes precedence. are specified, the _last_ one takes precedence.
*--fullscreen* *-F*,*--fullscreen*
Start in fullscreen mode. If both *--maximized* and *--fullscreen* Start in fullscreen mode. If both *--maximized* and *--fullscreen*
are specified, the _last_ one takes precedence. are specified, the _last_ one takes precedence.
*--login-shell* *-L*,*--login-shell*
Start a login shell, by prepending a '-' to argv[0]. Start a login shell, by prepending a '-' to argv[0].
*-s*,*--server-socket*=_PATH_ *-s*,*--server-socket*=_PATH_
Connect to _PATH_ instead of Connect to _PATH_ instead of
*$XDG\_RUNTIME\_DIR/foot-$WAYLAND\_DISPLAY.sock*. *$XDG\_RUNTIME\_DIR/foot-$WAYLAND\_DISPLAY.sock*.
*--hold* *-H*,*--hold*
Remain open after child process exits. Remain open after child process exits.
*-l*,*--log-colorize*=[{*never*,*always*,*auto*}] *-l*,*--log-colorize*=[{*never*,*always*,*auto*}]

2
main.c
View file

@ -191,7 +191,7 @@ main(int argc, char *const *argv)
user_notifications_t user_notifications = tll_init(); user_notifications_t user_notifications = tll_init();
while (true) { while (true) {
int c = getopt_long(argc, argv, "+c:Ct:a:Lf:g:w:W:s::Pp:l::Svh", longopts, NULL); int c = getopt_long(argc, argv, "+c:Ct:T:a:Lf:g:w:W:s::HmFPp:l::Svh", longopts, NULL);
if (c == -1) if (c == -1)
break; break;