-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.poly-completion.bash
More file actions
53 lines (52 loc) · 2.8 KB
/
.poly-completion.bash
File metadata and controls
53 lines (52 loc) · 2.8 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
# bash completion for the `poly` command
_poly_complete() {
local cur
# Pointer to current completion word.
# By convention, it's named "cur" but this isn't strictly necessary.
cur=${COMP_WORDS[COMP_CWORD]}
if [[ ${COMP_WORDS[1]} == "import" ]]; then
COMPREPLY=( $( compgen -W 'local-database-to-remote remote-database-to-local' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "check" ]]; then
COMPREPLY=( $( compgen -W 'uploads' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "optimize" ]]; then
COMPREPLY=( $( compgen -W 'local-assets local-uploads' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "bootstrap" ]]; then
COMPREPLY=( $( compgen -W 'wordpress static static-spa' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "clear" ]]; then
COMPREPLY=( $( compgen -W 'remote-cache' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "backup" ]]; then
COMPREPLY=( $( compgen -W 'remote-sites remote-sites-light' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "all" ]]; then
COMPREPLY=( $( compgen -W 'dump-remote-db dump-remote-htaccess dump-remote-env dump-remote-config import-remote-databases-to-local import-local-databases-to-remote deploy update copy-remote-uploads copy-local-uploads npm-install open-sites open-pagespeed open-validate-html open-resizer symlink-uploads exec-command' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "commit" ]]; then
COMPREPLY=( $( compgen -W 'local-database remote-database' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "copy" ]]; then
if [[ ${COMP_WORDS[2]} == "local" ]]; then
COMPREPLY=( $( compgen -W 'uploads-to-remote' -- $cur ) );
elif [[ ${COMP_WORDS[2]} == "remote" ]]; then
COMPREPLY=( $( compgen -W 'uploads-to-local' -- $cur ) );
elif [[ ${COMP_WORDS[2]} == "static" ]]; then
COMPREPLY=( $( compgen -W 'assets styles scripts fonts images' -- $cur ) );
else
COMPREPLY=( $( compgen -W 'local remote static' -- $cur ) );
fi
elif [[ ${COMP_WORDS[1]} == "change" ]]; then
COMPREPLY=( $( compgen -W 'git-upstream' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "create" ]]; then
COMPREPLY=( $( compgen -W 'gh-pages gh-pages-static' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "add" ]]; then
COMPREPLY=( $( compgen -W 'custom-post-types taxonomies' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "deploy" ]]; then
COMPREPLY=( $( compgen -W 'stage static production' -- $cur ) );
elif [[ ${COMP_WORDS[1]} == "restore" ]]; then
if [[ ${COMP_WORDS[2]} == "remote" ]]; then
COMPREPLY=( $( compgen -W 'site repository config uploads database' -- $cur ) );
else
COMPREPLY=( $( compgen -W 'remote' -- $cur ) );
fi
else
COMPREPLY=( $( compgen -W 'init init-static optimize import backup bootstrap restore clear commit check copy create add deploy change all' -- $cur ) );
fi
}
complete -o nospace -F _poly_complete poly