forked from tdewolff/minify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbash_completion
More file actions
35 lines (30 loc) · 1.56 KB
/
Copy pathbash_completion
File metadata and controls
35 lines (30 loc) · 1.56 KB
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
#!/usr/bin/env bash
if [ -n "$ZSH_NAME" ]; then
# zsh sets $ZSH_NAME variable so it can be used to detect zsh
# following enables using bash-completion under zsh
autoload bashcompinit
bashcompinit
fi
_minify_complete() {
local cur prev flags mimes types
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
flags="-a --all --bundle --cpuprofile -l --list --match --memprofile --mime -o --output -p --preserve --preserve-links -r --recursive --type --url -v --verbose --version -w --watch --css-precision --html-keep-comments --html-keep-conditional-comments --html-keep-default-attrvals --html-keep-document-tags --html-keep-end-tags --html-keep-quotes --html-keep-whitespace --js-precision --js-keep-var-names --json-precision --json-keep-numbers --svg-precision -s --sync --xml-keep-whitespace"
mimes="text/css text/html text/javascript application/javascript application/json image/svg+xml text/xml application/xml"
types="css html js json svg xml"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${flags}" -- "${cur}") )
elif [[ ${prev} =~ ^--mime$ ]] ; then
COMPREPLY=( $(compgen -W "${mimes}" -- "${cur}") )
elif [[ ${prev} =~ ^--type$ ]] ; then
COMPREPLY=( $(compgen -W "${types}" -- "${cur}") )
elif [[ ${prev} =~ ^--(match|url|css-precision|js-precision|json-precision|svg-precision|cpuprofile|memprofile)$ ]] ; then
compopt +o default
COMPREPLY=()
else
compopt -o default
COMPREPLY=()
fi
return 0
}
complete -F _minify_complete minify