2018-03-07 16:34:05 -05:00
|
|
|
#compdef alacritty
|
|
|
|
|
2021-11-19 18:34:40 -05:00
|
|
|
autoload -U is-at-least
|
2018-03-07 16:34:05 -05:00
|
|
|
|
2021-11-19 18:34:40 -05:00
|
|
|
_alacritty() {
|
|
|
|
typeset -A opt_args
|
|
|
|
typeset -a _arguments_options
|
|
|
|
local ret=1
|
2021-10-23 03:16:47 -04:00
|
|
|
|
2021-11-19 18:34:40 -05:00
|
|
|
if is-at-least 5.2; then
|
|
|
|
_arguments_options=(-s -S -C)
|
|
|
|
else
|
|
|
|
_arguments_options=(-s -C)
|
|
|
|
fi
|
2021-10-23 03:16:47 -04:00
|
|
|
|
2021-11-19 18:34:40 -05:00
|
|
|
local context curcontext="$curcontext" state line
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2022-01-04 13:25:26 -05:00
|
|
|
'--embed=[Defines the X11 window ID (as a decimal integer) to embed Alacritty within]:EMBED: ' \
|
|
|
|
'--config-file=[Specify alternative configuration file \[default: $XDG_CONFIG_HOME/alacritty/alacritty.yml\]]:CONFIG_FILE: ' \
|
|
|
|
'--socket=[Path for IPC socket creation]:SOCKET: ' \
|
|
|
|
'*-o+[Override configuration file options \[example: cursor.style=Beam\]]:OPTION: ' \
|
|
|
|
'*--option=[Override configuration file options \[example: cursor.style=Beam\]]:OPTION: ' \
|
|
|
|
'--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY: ' \
|
|
|
|
'*-e+[Command and args to execute (must be last argument)]:COMMAND: ' \
|
|
|
|
'*--command=[Command and args to execute (must be last argument)]:COMMAND: ' \
|
|
|
|
'-t+[Defines the window title \[default: Alacritty\]]:TITLE: ' \
|
|
|
|
'--title=[Defines the window title \[default: Alacritty\]]:TITLE: ' \
|
|
|
|
'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]:instance> | <instance>,<general: ' \
|
|
|
|
'-h[Print help information]' \
|
|
|
|
'--help[Print help information]' \
|
|
|
|
'-V[Print version information]' \
|
|
|
|
'--version[Print version information]' \
|
2021-11-19 18:34:40 -05:00
|
|
|
'--print-events[Print all events to stdout]' \
|
|
|
|
'--ref-test[Generates ref test]' \
|
|
|
|
'(-v)*-q[Reduces the level of verbosity (the min level is -qq)]' \
|
|
|
|
'(-q)*-v[Increases the level of verbosity (the max level is -vvv)]' \
|
2021-11-22 13:34:09 -05:00
|
|
|
'--hold[Remain open after child process exit]' \
|
2021-11-19 18:34:40 -05:00
|
|
|
":: :_alacritty_commands" \
|
|
|
|
"*::: :->alacritty" \
|
|
|
|
&& ret=0
|
|
|
|
case $state in
|
|
|
|
(alacritty)
|
|
|
|
words=($line[1] "${words[@]}")
|
|
|
|
(( CURRENT += 1 ))
|
|
|
|
curcontext="${curcontext%:*:*}:alacritty-command-$line[1]:"
|
|
|
|
case $line[1] in
|
|
|
|
(msg)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2022-01-04 13:25:26 -05:00
|
|
|
'-s+[IPC socket connection path override]:SOCKET: ' \
|
|
|
|
'--socket=[IPC socket connection path override]:SOCKET: ' \
|
|
|
|
'-h[Print help information]' \
|
|
|
|
'--help[Print help information]' \
|
2021-11-19 18:34:40 -05:00
|
|
|
":: :_alacritty__msg_commands" \
|
|
|
|
"*::: :->msg" \
|
|
|
|
&& ret=0
|
2022-01-04 13:25:26 -05:00
|
|
|
|
|
|
|
case $state in
|
2021-11-19 18:34:40 -05:00
|
|
|
(msg)
|
|
|
|
words=($line[1] "${words[@]}")
|
|
|
|
(( CURRENT += 1 ))
|
|
|
|
curcontext="${curcontext%:*:*}:alacritty-msg-command-$line[1]:"
|
|
|
|
case $line[1] in
|
|
|
|
(create-window)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2022-01-04 13:25:26 -05:00
|
|
|
'--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY: ' \
|
|
|
|
'*-e+[Command and args to execute (must be last argument)]:COMMAND: ' \
|
|
|
|
'*--command=[Command and args to execute (must be last argument)]:COMMAND: ' \
|
|
|
|
'-t+[Defines the window title \[default: Alacritty\]]:TITLE: ' \
|
|
|
|
'--title=[Defines the window title \[default: Alacritty\]]:TITLE: ' \
|
|
|
|
'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]:instance> | <instance>,<general: ' \
|
|
|
|
'--version[Print version information]' \
|
2021-11-22 13:34:09 -05:00
|
|
|
'--hold[Remain open after child process exit]' \
|
2022-01-04 13:25:26 -05:00
|
|
|
'-h[Print help information]' \
|
|
|
|
'--help[Print help information]' \
|
2021-11-19 18:34:40 -05:00
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(help)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2022-01-04 13:25:26 -05:00
|
|
|
'--version[Print version information]' \
|
|
|
|
'-h[Print help information]' \
|
|
|
|
'--help[Print help information]' \
|
2021-11-19 18:34:40 -05:00
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
(help)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
2021-10-23 03:16:47 -04:00
|
|
|
}
|
|
|
|
|
2021-11-19 18:34:40 -05:00
|
|
|
(( $+functions[_alacritty_commands] )) ||
|
|
|
|
_alacritty_commands() {
|
|
|
|
local commands; commands=(
|
2022-01-04 13:25:26 -05:00
|
|
|
'msg:Send a message to the Alacritty socket' \
|
|
|
|
'help:Print this message or the help of the given subcommand(s)' \
|
2021-11-19 18:34:40 -05:00
|
|
|
)
|
|
|
|
_describe -t commands 'alacritty commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_alacritty__msg__create-window_commands] )) ||
|
|
|
|
_alacritty__msg__create-window_commands() {
|
2022-01-04 13:25:26 -05:00
|
|
|
local commands; commands=()
|
2021-11-19 18:34:40 -05:00
|
|
|
_describe -t commands 'alacritty msg create-window commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_alacritty__help_commands] )) ||
|
|
|
|
_alacritty__help_commands() {
|
2022-01-04 13:25:26 -05:00
|
|
|
local commands; commands=()
|
2021-11-19 18:34:40 -05:00
|
|
|
_describe -t commands 'alacritty help commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_alacritty__msg__help_commands] )) ||
|
|
|
|
_alacritty__msg__help_commands() {
|
2022-01-04 13:25:26 -05:00
|
|
|
local commands; commands=()
|
2021-11-19 18:34:40 -05:00
|
|
|
_describe -t commands 'alacritty msg help commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_alacritty__msg_commands] )) ||
|
|
|
|
_alacritty__msg_commands() {
|
|
|
|
local commands; commands=(
|
2022-01-04 13:25:26 -05:00
|
|
|
'create-window:Create a new window in the same Alacritty process' \
|
|
|
|
'help:Print this message or the help of the given subcommand(s)' \
|
2021-11-19 18:34:40 -05:00
|
|
|
)
|
|
|
|
_describe -t commands 'alacritty msg commands' commands "$@"
|
2021-10-23 03:16:47 -04:00
|
|
|
}
|
|
|
|
|
2021-11-19 18:34:40 -05:00
|
|
|
_alacritty "$@"
|