Change output of --list-profiles and --list-layouts

Bash completion is also added for --profile and --layout but it won't
work if the profile/layout has quotes or spaces in the name.
This commit is contained in:
Vulcalien 2021-10-11 12:04:47 +02:00
parent 4dbfcb481b
commit 817f820cfb
2 changed files with 17 additions and 2 deletions

View File

@ -5,6 +5,19 @@ _terminator()
local cur prev words cword local cur prev words cword
_init_completion || return _init_completion || return
case $prev in
--profile | -p)
COMPREPLY=($(compgen -W "$($1 --list-profiles)"\
-- "$cur"))
return
;;
--layout | -l)
COMPREPLY=($(compgen -W "$($1 --list-layouts)"\
-- "$cur"))
return
;;
esac
COMPREPLY=($(compgen -W "$($1 --help | tr ',' '\n' | COMPREPLY=($(compgen -W "$($1 --help | tr ',' '\n' |
command sed -n -e 's/^ *\(--\?[a-zA-Z\-]\+=\?\).*/\1/p')"\ command sed -n -e 's/^ *\(--\?[a-zA-Z\-]\+=\?\).*/\1/p')"\
-- "$cur")) -- "$cur"))

View File

@ -114,10 +114,12 @@ icon for the window (by file or name)'))
sys.exit(0) sys.exit(0)
if options.list_profiles: if options.list_profiles:
print(Terminator().config.list_profiles()) for p in Terminator().config.list_profiles():
print(p)
sys.exit(0) sys.exit(0)
if options.list_layouts: if options.list_layouts:
print(Terminator().config.list_layouts()) for l in Terminator().config.list_layouts():
print(l)
sys.exit(0) sys.exit(0)
if options.debug_classes or options.debug_methods: if options.debug_classes or options.debug_methods: