File: bash_completion

package info (click to toggle)
golang-github-tdewolff-minify 2.24.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 39,412 kB
  • sloc: javascript: 394,644; xml: 25,649; ansic: 253; makefile: 111; python: 109; sh: 74
file content (30 lines) | stat: -rw-r--r-- 1,825 bytes parent folder | download
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
#!/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 types
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    flags="-a --all --bundle --exclude --ext -i --include --inplace -l --list --match -o --output -p --preserve -q --quiet -r --recursive --type --url -v --verbose --version -w --watch --css-precision --css-version --html-keep-comments --html-keep-special-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 --js-version --json-precision --json-keep-numbers --svg-keep-comments --svg-precision -s --sync --xml-keep-whitespace"
    types="asp css ejs gohtml handlebars html js json mustache php rss svg tmpl webmanifest xhtml xml text/asp text/css text/x-ejs-template text/x-go-template text/x-handlebars-template text/html text/javascript application/javascript application/json text/x-mustache-template application/x-httpd-php application/rss+xml image/svg+xml text/x-template application/manifest+json application/xhtml+xml text/xml application/xml"
    if echo "${cur}" | grep -Eq '^-'; then
        COMPREPLY=($(compgen -W "${flags}" -- "${cur}"))
    elif echo "${prev}" | grep -Eq '^--type$'; then
        COMPREPLY=($(compgen -W "${types}" -- "${cur}"))
    elif echo "${prev}" | grep -Eq '^--(css-precision|css-version|ext|js-precision|js-version|json-precision|preserve|svg-precision|url)$'; then
        compopt +o default
        COMPREPLY=()
    else
        compopt -o default
        COMPREPLY=()
    fi
    return 0
}

complete -F _minify_complete minify