2018-08-27 22:38:23 -04:00
|
|
|
|
|
|
|
# Check for bash
|
|
|
|
[ -z "$BASH_VERSION" ] && return
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
__gnome_extensions() {
|
2019-07-24 09:18:59 -04:00
|
|
|
local commands="version enable disable reset info install show list create pack prefs uninstall"
|
2018-08-27 22:38:23 -04:00
|
|
|
local COMMAND=${COMP_WORDS[1]}
|
|
|
|
|
|
|
|
_init_completion -s || return
|
|
|
|
|
|
|
|
case "${COMP_CWORD}" in
|
|
|
|
1)
|
|
|
|
COMPREPLY=($(compgen -W "help $commands" -- "$2"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
2)
|
|
|
|
case "$COMMAND" in
|
|
|
|
help)
|
|
|
|
COMPREPLY=($(compgen -W "$commands" -- "$2"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
disable)
|
|
|
|
local list_opt=--enabled
|
|
|
|
;;&
|
|
|
|
enable)
|
|
|
|
local list_opt=--disabled
|
|
|
|
;;&
|
2019-01-11 06:03:17 -05:00
|
|
|
prefs)
|
|
|
|
local list_opt=--prefs
|
|
|
|
;;&
|
2019-07-11 16:35:49 -04:00
|
|
|
uninstall)
|
|
|
|
local list_opt=--user
|
|
|
|
;;&
|
2019-07-24 09:18:59 -04:00
|
|
|
enable|disable|info|show|prefs|reset|uninstall)
|
2018-08-27 22:38:23 -04:00
|
|
|
COMPREPLY=($(compgen -W "`gnome-extensions list $list_opt`" -- "$2"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2018-08-30 23:14:23 -04:00
|
|
|
case "$COMMAND" in
|
2019-11-07 06:46:47 -05:00
|
|
|
create)
|
|
|
|
case "$prev" in
|
|
|
|
--template)
|
|
|
|
COMPREPLY=($(compgen -W "`gnome-extensions create --list-templates`" -- "$2"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2018-08-30 23:14:23 -04:00
|
|
|
pack)
|
|
|
|
case "$prev" in
|
|
|
|
--podir|--out-dir|-o)
|
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--schema)
|
|
|
|
_filedir gschema.xml
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--extra-source)
|
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2018-09-03 19:41:55 -04:00
|
|
|
install)
|
|
|
|
if [[ $cur != -* ]]
|
|
|
|
then
|
|
|
|
_filedir zip
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
;;
|
2018-08-30 23:14:23 -04:00
|
|
|
esac
|
|
|
|
|
2018-08-27 22:38:23 -04:00
|
|
|
# Stop if we are currently waiting for an option value
|
|
|
|
$split && return
|
|
|
|
|
|
|
|
# Otherwise, get the supported options for ${COMMAND} (if any)
|
|
|
|
COMPREPLY=($(compgen -W "$(_parse_help $1 "help $COMMAND")" -- "$2"))
|
|
|
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
complete -F __gnome_extensions gnome-extensions
|