From 8eaa1959904ecff0e7e75d152220344457912f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 23 Nov 2020 19:19:19 +0100 Subject: [PATCH] foot/footclient: add short options to all command line options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e81388336750a20a2da98a57e9726c8ba1b481e3 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(). --- CHANGELOG.md | 2 ++ completions/zsh/_foot | 12 ++++++------ completions/zsh/_footclient | 10 +++++----- doc/foot.1.scd | 10 +++++----- doc/footclient.1.scd | 10 +++++----- main.c | 2 +- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12c057bc..88a48699 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). * `-w,--window-size-pixels` and `-W,--window-size-chars` command line 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 diff --git a/completions/zsh/_foot b/completions/zsh/_foot index b9019b93..cfcd9533 100644 --- a/completions/zsh/_foot +++ b/completions/zsh/_foot @@ -3,18 +3,18 @@ _arguments \ -s -S -C \ '(-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' \ '(-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)]:()' \ - '--maximized[start in maximized mode]' \ - '--fullscreen[start in fullscreen mode]' \ - '--login-shell[start shell as a login shell]' \ + '(-m --maximized)'{-m,--maximized}'[start in maximized mode]' \ + '(-F --fullscreen)'{-F,--fullscreen}'[start in fullscreen mode]' \ + '(-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-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' \ - '--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' \ '(-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)]' \ diff --git a/completions/zsh/_footclient b/completions/zsh/_footclient index 3c375fd1..26aa2c5c 100644 --- a/completions/zsh/_footclient +++ b/completions/zsh/_footclient @@ -3,15 +3,15 @@ _arguments \ -s -S -C \ '(-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)]:()' \ - '--maximized[start in maximized mode]' \ - '--fullscreen[start in fullscreen mode]' \ - '--login-shell[start shell as a login shell]' \ + '(-m --maximized)'{-m,--maximized}'[start in maximized mode]' \ + '(-F --fullscreen)'{-F,--fullscreen}'[start in fullscreen mode]' \ + '(-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-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' \ - '--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)' \ '(-v --version)'{-v,--version}'[show the version number and quit]' \ '(-h --help)'{-h,--help}'[show help message and quit]' \ diff --git a/doc/foot.1.scd b/doc/foot.1.scd index e3be3013..d397c9e8 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -26,7 +26,7 @@ the foot command line Path to configuration file. Default: *$XDG_CONFIG_HOME/foot/foot.ini*. -*--check-config* +*-C*,*--check-config* Verify configuration and then exit with 0 if ok, otherwise exit with 1. @@ -57,18 +57,18 @@ the foot command line *-t*,*--term*=_TERM_ Value to set the environment variable *TERM* to. Default: _foot_. -*--title*=_TITLE_ +*-T*,*--title*=_TITLE_ Initial window title. Default: _foot_. *-a*,*--app-id*=_ID_ Value to set the *app-id* property on the Wayland window to. Default: _foot_. -*--maximized* +*-m*,*--maximized* Start in maximized mode. If both *--maximized* and *--fullscreen* are specified, the _last_ one takes precedence. -*--fullscreen* +*-F*,*--fullscreen* Start in fullscreen mode. If both *--maximized* and *--fullscreen* 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 custom socket path. -*--hold* +*-H*,*--hold* Remain open after child process exits. *-p*,*--print-pid*=_FILE_|_FD_ diff --git a/doc/footclient.1.scd b/doc/footclient.1.scd index cc520391..f9c95913 100644 --- a/doc/footclient.1.scd +++ b/doc/footclient.1.scd @@ -25,7 +25,7 @@ terminal has terminated). *-t*,*--term*=_TERM_ Value to set the environment variable *TERM* to. Default: _foot_. -*--title*=_TITLE_ +*-T*,*--title*=_TITLE_ Initial window title. Default: _foot_. *-a*,*--app-id*=_ID_ @@ -38,22 +38,22 @@ terminal has terminated). *-W*,*--window-size-chars*=_WIDTHxHEIGHT_ Set initial window width and height, in characters. Default: _not set_. -*--maximized* +*-m*,*--maximized* Start in maximized mode. If both *--maximized* and *--fullscreen* are specified, the _last_ one takes precedence. -*--fullscreen* +*-F*,*--fullscreen* Start in fullscreen mode. If both *--maximized* and *--fullscreen* are specified, the _last_ one takes precedence. -*--login-shell* +*-L*,*--login-shell* Start a login shell, by prepending a '-' to argv[0]. *-s*,*--server-socket*=_PATH_ Connect to _PATH_ instead of *$XDG\_RUNTIME\_DIR/foot-$WAYLAND\_DISPLAY.sock*. -*--hold* +*-H*,*--hold* Remain open after child process exits. *-l*,*--log-colorize*=[{*never*,*always*,*auto*}] diff --git a/main.c b/main.c index b1a81b88..af84691d 100644 --- a/main.c +++ b/main.c @@ -191,7 +191,7 @@ main(int argc, char *const *argv) user_notifications_t user_notifications = tll_init(); 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) break;