-
Notifications
You must be signed in to change notification settings - Fork 0
/
dnu
54 lines (54 loc) · 2.35 KB
/
dnu
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
54
_dnu()
{
local cur prev opts command help dnu_commands restore publish pack build install packages list commands_opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [ $COMP_CWORD -gt 0 ]; then
command="${COMP_WORDS[1]}"
fi
help="-? -h --help"
opts="$help -v -version --verbose"
dnu_commands="restore help publish pack build install packages list commands $help"
restore="-s --source -f --fallback -p --proxy --no-cache --packages --ignore-failed-sources --quiet --lock --unlock --parallel $help"
publish="-o --out --configuration --nosource --runtime --native --wwwroot --wwwroot-out --quiet $help"
pack="--framework --configuration --out --dependencies --quiet $help"
build="--framework --configuration --out --quiet $help"
install="-s --source -f --fallback -p --proxy --no-cache --packages --ignore-failed-sources --quiet $help"
packages="add help push pull $help"
list="-a --assemblies --framework --runtime --hide-dependents --filter $help"
commands_opts="help install uninstall $help"
local cur prev opts command help dnu_commands restore publish pack build install packages list commands_opts
if [ ${prev} == dnu ] ; then
COMPREPLY=( $(compgen -W "$opts $dnu_commands" -- ${cur}) )
return 0
elif [[ ${prev} == help ]] ; then
COMPREPLY=( $(compgen -W "$dnu_commands" -- ${cur}) )
return 0
elif [ ${command} == restore ] ; then
COMPREPLY=( $(compgen -W "$install" -- ${cur}) )
return 0
elif [ ${command} == publish ] ; then
COMPREPLY=( $(compgen -W "$publish" -- ${cur}) )
return 0
elif [ ${command} == pack ] ; then
COMPREPLY=( $(compgen -W "$pack" -- ${cur}) )
return 0
elif [ ${command} == packages ] ; then
COMPREPLY=( $(compgen -W "$packages" -- ${cur}) )
return 0
elif [ ${command} == build ] ; then
COMPREPLY=( $(compgen -W "$build" -- ${cur}) )
return 0
elif [ ${command} == install ] ; then
COMPREPLY=( $(compgen -W "$restore" -- ${cur}) )
return 0
elif [ ${command} == list ] ; then
COMPREPLY=( $(compgen -W "$list" -- ${cur}) )
return 0
elif [ ${command} == commands ] ; then
COMPREPLY=( $(compgen -W "$commands_opts" -- ${cur}) )
return 0
fi
}
complete -F _dnu dnu