-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadm
executable file
·142 lines (135 loc) · 3.64 KB
/
adm
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!bash
#
# AMOEBA
# Addon-Manager (OFBiz ERP) Bash Autocomplete
#
# Copyright 2013-2014 François Lecomte (Néréide)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
have adm &&
{
_completion()
{
# Built-in completion
# see: http://www.gnu.org/software/bash/manual/html_node/Programmable-Completion-Builtins.html
compopt -o filenames
}
_adm()
{
local cur prev opts
COMPREPLY=()
_get_comp_words_by_ref cur prev
# This should contain all supported commands and aliases
# However, the following alias was removed: wa
opts="aaf add-all-files add-directory add-file af diff help init install l list ll lw list-file new-addon remove-file revert rf seal status ul uninstall uninstall-all up update-file update-location version which-addon"
case $prev in
# All ADM commands' completion options
adm)
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
;;
add-all-files|aaf)
_completion
COMPREPLY=( $( compgen -W "-addon -d" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
add-directory)
_completion
COMPREPLY=( $( compgen -W "-addon -f -size" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
add-file|af)
_completion
COMPREPLY=( $( compgen -W "-addon -d -f -size" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
diff)
_completion
COMPREPLY=( $( compgen -W "* -all -index -r -size" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
help)
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
;;
init)
COMPREPLY=( $( compgen -W "-branch -filter -repository" -- "$cur" ) )
;;
install)
_completion
COMPREPLY=( $( compgen -W "--force-all --force-depen --force-ivy-tree --force-patch -org -v" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
list|l)
COMPREPLY=( $( compgen -W "-c -head -m -tree -work -works" -- "$cur" ) )
;;
ll|lw)
COMPREPLY=( $( compgen -W "-c -m -tree" -- "$cur" ) )
;;
# Could be improved (with : `adm list` | grep)
list-file)
return 0
;;
new-addon)
_completion
COMPREPLY=( $( compgen -W "-d" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
remove-file|rf)
_completion
COMPREPLY=( $( compgen -W "-addon" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
revert)
_completion
COMPREPLY=( $( compgen -W "-all -r" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
seal)
COMPREPLY=( $( compgen -W "-revision" -- "$cur" ))
;;
status)
COMPREPLY=( $( compgen -W "-detail" -- "$cur" ))
;;
# Could be improved (with : `adm list` | grep)
uninstall)
COMPREPLY=( $( compgen -W "--force-revert --no-reload" -- "$cur" ) )
;;
uninstall-all)
COMPREPLY=( $( compgen -W "--force-revert" -- "$cur" ))
;;
update-file|up)
_completion
COMPREPLY=( $( compgen -W "-addon -d -size" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
update-location|ul)
_completion
COMPREPLY=( $( compgen -W "-i -location -name -r" -- "$cur" ) )
;;
version)
return 0
;;
which-addon|wa)
_completion
COMPREPLY=( $( compgen -W "-detail" -- "$cur" ) \
$( compgen -f -- "$cur" ) )
;;
# Default completion
*)
_completion
COMPREPLY=( $( compgen -f -- "$cur" ) )
;;
esac
return 0
} &&
complete -F _adm adm
}