summaryrefslogtreecommitdiffstats
path: root/extra/completions/_alacritty
blob: 1313128e74cd610a88dd696c298f469fcb044918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#compdef alacritty

# Completions available for the first parameter.
_alacritty_first_param() {
    # Main subcommands.
    _describe "command" "(msg:'Available socket messages')"

    # 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 \
  "1: :_alacritty_first_param" \
  "*: :_alacritty_following_param"