diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2021-11-22 21:34:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 18:34:09 +0000 |
commit | 8681f71084894db6d1e258be17db1f80bb669314 (patch) | |
tree | 24d3c0ced916d2d171fd03f50cd34dcda8f0aa06 /extra/completions | |
parent | c89939b5d14e581e1aeaa940d81843192e0abc79 (diff) | |
download | alacritty-8681f71084894db6d1e258be17db1f80bb669314.tar.gz alacritty-8681f71084894db6d1e258be17db1f80bb669314.zip |
Add parameters to `msg create-window` subcommand
Alacritty's `msg create-window` subcommand would previously inherit all
the CLI parameters from the original executable. However not only could
this lead to unexpected behavior, it also prevents multi-window users
from making use of parameters like `-e`, `--working-directory`, or
`--hold`.
This is solved by adding a JSON-based message format to the IPC socket
messages which instructs the Alacritty server on which CLI parameters
should be used to create the new window.
Fixes #5562.
Fixes #5561.
Fixes #5560.
Diffstat (limited to 'extra/completions')
-rw-r--r-- | extra/completions/_alacritty | 12 | ||||
-rw-r--r-- | extra/completions/alacritty.bash | 30 | ||||
-rw-r--r-- | extra/completions/alacritty.fish | 9 |
3 files changed, 35 insertions, 16 deletions
diff --git a/extra/completions/_alacritty b/extra/completions/_alacritty index 32086910..59ed92b2 100644 --- a/extra/completions/_alacritty +++ b/extra/completions/_alacritty @@ -19,18 +19,18 @@ _alacritty() { '--title=[Defines the window title \[default: Alacritty\]]' \ '--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]' \ '--embed=[Defines the X11 window ID (as a decimal integer) to embed Alacritty within]' \ -'--working-directory=[Start the shell in the specified working directory]' \ '--config-file=[Specify alternative configuration file \[default: $XDG_CONFIG_HOME/alacritty/alacritty.yml\]]' \ '--socket=[Path for IPC socket creation]' \ -'*-e+[Command and args to execute (must be last argument)]' \ -'*--command=[Command and args to execute (must be last argument)]' \ '*-o+[Override configuration file options \[example: cursor.style=Beam\]]' \ '*--option=[Override configuration file options \[example: cursor.style=Beam\]]' \ +'--working-directory=[Start the shell in the specified working directory]' \ +'*-e+[Command and args to execute (must be last argument)]' \ +'*--command=[Command and args to execute (must be last argument)]' \ '--print-events[Print all events to stdout]' \ '--ref-test[Generates ref test]' \ -'--hold[Remain open after child process exits]' \ '(-v)*-q[Reduces the level of verbosity (the min level is -qq)]' \ '(-q)*-v[Increases the level of verbosity (the max level is -vvv)]' \ +'--hold[Remain open after child process exit]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ @@ -63,6 +63,10 @@ case $state in case $line[1] in (create-window) _arguments "${_arguments_options[@]}" \ +'--working-directory=[Start the shell in the specified working directory]' \ +'*-e+[Command and args to execute (must be last argument)]' \ +'*--command=[Command and args to execute (must be last argument)]' \ +'--hold[Remain open after child process exit]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ diff --git a/extra/completions/alacritty.bash b/extra/completions/alacritty.bash index 0a9b286e..7ce57f9d 100644 --- a/extra/completions/alacritty.bash +++ b/extra/completions/alacritty.bash @@ -29,7 +29,7 @@ _alacritty() { case "${cmd}" in alacritty) - opts=" -q -v -h -V -t -e -o --print-events --ref-test --hold --help --version --title --class --embed --working-directory --config-file --socket --command --option msg help" + opts=" -q -v -h -V -t -o -e --print-events --ref-test --hold --help --version --title --class --embed --config-file --socket --option --working-directory --command msg help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -52,31 +52,31 @@ _alacritty() { COMPREPLY=($(compgen -f "${cur}")) return 0 ;; - --working-directory) + --config-file) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; - --config-file) + --socket) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; - --socket) + --option) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; - --command) + -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; - -e) + --working-directory) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; - --option) + --command) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; - -o) + -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; @@ -127,13 +127,25 @@ _alacritty() { return 0 ;; alacritty__msg__create__window) - opts=" -h -V --help --version " + opts=" -h -V -e --hold --help --version --working-directory --command " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in + --working-directory) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --command) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + -e) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; *) COMPREPLY=() ;; diff --git a/extra/completions/alacritty.fish b/extra/completions/alacritty.fish index 48f118c2..09cc6c0f 100644 --- a/extra/completions/alacritty.fish +++ b/extra/completions/alacritty.fish @@ -1,16 +1,16 @@ complete -c alacritty -n "__fish_use_subcommand" -s t -l title -d 'Defines the window title [default: Alacritty]' complete -c alacritty -n "__fish_use_subcommand" -l class -d 'Defines window class/app_id on X11/Wayland [default: Alacritty]' complete -c alacritty -n "__fish_use_subcommand" -l embed -d 'Defines the X11 window ID (as a decimal integer) to embed Alacritty within' -complete -c alacritty -n "__fish_use_subcommand" -l working-directory -d 'Start the shell in the specified working directory' complete -c alacritty -n "__fish_use_subcommand" -l config-file -d 'Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml]' complete -c alacritty -n "__fish_use_subcommand" -l socket -d 'Path for IPC socket creation' -complete -c alacritty -n "__fish_use_subcommand" -s e -l command -d 'Command and args to execute (must be last argument)' complete -c alacritty -n "__fish_use_subcommand" -s o -l option -d 'Override configuration file options [example: cursor.style=Beam]' +complete -c alacritty -n "__fish_use_subcommand" -l working-directory -d 'Start the shell in the specified working directory' +complete -c alacritty -n "__fish_use_subcommand" -s e -l command -d 'Command and args to execute (must be last argument)' complete -c alacritty -n "__fish_use_subcommand" -l print-events -d 'Print all events to stdout' complete -c alacritty -n "__fish_use_subcommand" -l ref-test -d 'Generates ref test' -complete -c alacritty -n "__fish_use_subcommand" -l hold -d 'Remain open after child process exits' complete -c alacritty -n "__fish_use_subcommand" -s q -d 'Reduces the level of verbosity (the min level is -qq)' complete -c alacritty -n "__fish_use_subcommand" -s v -d 'Increases the level of verbosity (the max level is -vvv)' +complete -c alacritty -n "__fish_use_subcommand" -l hold -d 'Remain open after child process exit' complete -c alacritty -n "__fish_use_subcommand" -s h -l help -d 'Prints help information' complete -c alacritty -n "__fish_use_subcommand" -s V -l version -d 'Prints version information' complete -c alacritty -n "__fish_use_subcommand" -f -a "msg" -d 'Available socket messages' @@ -20,6 +20,9 @@ complete -c alacritty -n "__fish_seen_subcommand_from msg" -s h -l help -d 'Prin complete -c alacritty -n "__fish_seen_subcommand_from msg" -s V -l version -d 'Prints version information' complete -c alacritty -n "__fish_seen_subcommand_from msg" -f -a "create-window" -d 'Create a new window in the same Alacritty process' complete -c alacritty -n "__fish_seen_subcommand_from msg" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)' +complete -c alacritty -n "__fish_seen_subcommand_from create-window" -l working-directory -d 'Start the shell in the specified working directory' +complete -c alacritty -n "__fish_seen_subcommand_from create-window" -s e -l command -d 'Command and args to execute (must be last argument)' +complete -c alacritty -n "__fish_seen_subcommand_from create-window" -l hold -d 'Remain open after child process exit' complete -c alacritty -n "__fish_seen_subcommand_from create-window" -s h -l help -d 'Prints help information' complete -c alacritty -n "__fish_seen_subcommand_from create-window" -s V -l version -d 'Prints version information' complete -c alacritty -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information' |