forked from gnome-terminator/terminator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash
19 lines (16 loc) · 735 Bytes
/
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# bash completion for terminator -*- shell-script -*-
_terminator()
{
local cur prev words cword
_init_completion || return
local OPTS_FILTER='s/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p'
local exe_opts=$($1 -h 2>&1 | sed -ne $OPTS_FILTER | sort -u)
if [[ "${prev}" == "--profile" || "${prev}" == "-p" ]]; then
COMPREPLY=($(compgen -W "$($1 --list-profiles | tr -d \' | sed 's/[][,]//g')" -- ${cur}))
elif [[ "${prev}" == "--layout" || "${prev}" == "-l" ]]; then
COMPREPLY=($(compgen -W "$($1 --list-layouts | tr -d \' | sed 's/[][,]//g')" -- ${cur}))
else
COMPREPLY=($(compgen -W "${exe_opts}" -- ${cur}))
fi
} &&
complete -F _terminator terminator