diff options
Diffstat (limited to 'extra/completions')
-rw-r--r-- | extra/completions/_alacritty | 74 | ||||
-rw-r--r-- | extra/completions/alacritty.bash | 9 | ||||
-rw-r--r-- | extra/completions/alacritty.fish | 62 |
3 files changed, 110 insertions, 35 deletions
diff --git a/extra/completions/_alacritty b/extra/completions/_alacritty index c97d563e..1313128e 100644 --- a/extra/completions/_alacritty +++ b/extra/completions/_alacritty @@ -1,20 +1,62 @@ #compdef alacritty -local ign +# Completions available for the first parameter. +_alacritty_first_param() { + # Main subcommands. + _describe "command" "(msg:'Available socket messages')" -(( $#words > 2 )) && ign='!' + # Default options. + _alacritty_main +} + +# Completions available for parameters after the first. +_alacritty_following_param() { + case $words[2] in + msg) + _alacritty_msg;; + *) + _alacritty_main;; + esac +} + +# Completions for the main Alacritty executable. +_alacritty_main() { + # Limit some suggestions to the first option. + local ignore + (( $#words > 2 )) && ignore='!' + + _arguments \ + "$ignore(-)"{-h,--help}"[print help information]" \ + "$ignore(-)"{-V,--version}"[print version information]" \ + "--print-events[print all events to stdout]" \ + '(-v)'{-q,-qq}"[reduce the level of verbosity (min is -qq)]" \ + "--ref-test[generate ref test]" \ + "--hold[remain open after child process exits]" \ + '(-q)'{-v,-vv,-vvv}"[increase the level of verbosity (max is -vvv)]" \ + "--class=[define the window class]:class" \ + "--embed=[define the X11 window ID (as a decimal integer) to embed Alacritty within]:windowId" \ + "(-e --command)"{-e,--command}"[execute command (must be last arg)]:program: _command_names -e:*::program arguments: _normal" \ + "--config-file=[specify an alternative config file]:file:_files" \ + "*"{-o=,--option=}"[override config file options]:option" \ + "(-t --title)"{-t=,--title=}"[define the window title]:title" \ + "--working-directory=[start shell in specified directory]:directory:_directories"\ + "--socket=[Path for IPC socket creation]:file:_files" +} + +# Completions for the `msg` subcommand. +_alacritty_msg() { + # Limit some suggestions to the first option. + local ignore + (( $#words > 3 )) && ignore='!' + + _arguments \ + "$ignore(-)"{-h,--help}"[print help information]" \ + "$ignore(-)"{-V,--version}"[print version information]" \ + "(-s --socket)"{-s=,--socket=}"[Path for IPC socket creation]:file:_files" \ + "*: :((create-window:'Create a new window in the same Alacritty process'))" +} + +# Handle arguments based on their position. _arguments \ - "$ign(-)"{-h,--help}"[print help information]" \ - "--print-events[print all events to stdout]" \ - '(-v)'{-q,-qq}"[reduce the level of verbosity (min is -qq)]" \ - "--ref-test[generate ref test]" \ - "--hold[remain open after child process exits]" \ - '(-q)'{-v,-vv,-vvv}"[increase the level of verbosity (max is -vvv)]" \ - "$ign(-)"{-V,--version}"[print version information]" \ - "--class=[define the window class]:class" \ - "--embed=[define the X11 window ID (as a decimal integer) to embed Alacritty within]:windowId" \ - "(-e --command)"{-e,--command}"[execute command (must be last arg)]:program: _command_names -e:*::program arguments: _normal" \ - "--config-file=[specify an alternative config file]:file:_files" \ - "*"{-o=,--option=}"[override config file options]:option" \ - "(-t --title)"{-t=,--title=}"[define the window title]:title" \ - "--working-directory=[start shell in specified directory]:directory:_directories" + "1: :_alacritty_first_param" \ + "*: :_alacritty_following_param" diff --git a/extra/completions/alacritty.bash b/extra/completions/alacritty.bash index e514126c..464afe6e 100644 --- a/extra/completions/alacritty.bash +++ b/extra/completions/alacritty.bash @@ -11,7 +11,7 @@ _alacritty() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" prevprev="${COMP_WORDS[COMP_CWORD-2]}" - opts="-h --help -V --version --print-events -q -qq -v -vv -vvv --ref-test --hold -e --command --config-file -o --option -t --title --embed --class --working-directory" + opts="-h --help -V --version --print-events -q -qq -v -vv -vvv --ref-test --hold -e --command --config-file -o --option -t --title --embed --class --working-directory --socket msg" # If `--command` or `-e` is used, stop completing for i in "${!COMP_WORDS[@]}"; do @@ -29,8 +29,8 @@ _alacritty() # Complete all commands in $PATH COMPREPLY=( $(compgen -c -- "${cur}") ) return 0;; - --config-file) - # Path based completion + --config-file | --socket) + # File completion local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- "${cur}") ) @@ -44,6 +44,9 @@ _alacritty() compopt -o filenames COMPREPLY=( $(compgen -d -- "${cur}") ) return 0;; + msg) + COMPREPLY=( $(compgen -W "-h --help -V --version -s --socket" -- "${cur}") ) + return 0;; esac # Show all flags if there was no previous word diff --git a/extra/completions/alacritty.fish b/extra/completions/alacritty.fish index 6f8da9b0..fa399ffb 100644 --- a/extra/completions/alacritty.fish +++ b/extra/completions/alacritty.fish @@ -1,74 +1,104 @@ +# Available subcommands +set -l commands msg help + +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ + -a "msg help" + # Meta complete -c alacritty \ + -n "not __fish_seen_subcommand_from help" \ -s "v" \ -l "version" \ -d "Prints version information" complete -c alacritty \ + -n "not __fish_seen_subcommand_from help" \ -s "h" \ -l "help" \ -d "Prints help information" # Config complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -f \ -l "config-file" \ -d "Specify an alternative config file" complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -s "t" \ -l "title" \ -d "Defines the window title" complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -l "class" \ -d "Defines the window class" complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -l "embed" \ -d "Defines the X11 window ID (as a decimal integer) to embed Alacritty within" complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -x \ -a '(__fish_complete_directories (commandline -ct))' \ -l "working-directory" \ -d "Start shell in specified directory" complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -l "hold" \ -d "Remain open after child process exits" complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -s "o" \ -l "option" \ -d "Override config file options" +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ + -l "socket" \ + -d "Path for IPC socket creation" # Output -complete \ - -c alacritty \ +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -l "print-events" \ -d "Print all events to stdout" -complete \ - -c alacritty \ +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -s "q" \ -d "Reduces the level of verbosity (min is -qq)" -complete \ - -c alacritty \ +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -s "qq" \ -d "Reduces the level of verbosity" -complete \ - -c alacritty \ +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -s "v" \ -d "Increases the level of verbosity" -complete \ - -c alacritty \ +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -s "vv" \ -d "Increases the level of verbosity" -complete \ - -c alacritty \ +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -s "vvv" \ -d "Increases the level of verbosity" -complete \ - -c alacritty \ +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -l "ref-test" \ -d "Generates ref test" -complete \ - -c alacritty \ +complete -c alacritty \ + -n "not __fish_seen_subcommand_from $commands" \ -s "e" \ -l "command" \ -d "Execute command (must be last arg)" + +# Subcommand `msg` +complete -c alacritty \ + -n "__fish_seen_subcommand_from msg" \ + -s "s" \ + -l "socket" \ + -d "Socket path override" +complete -c alacritty \ + -n "__fish_seen_subcommand_from msg" \ + -a "create-window help" |