-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsfdx.bash
167 lines (159 loc) · 5.17 KB
/
sfdx.bash
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/usr/bin/env bash
# DESCRIPTION: Bash completion script for the Salesforce CLI
# AUTHOR: Wade Wegner (@WadeWegner)
# REPO: https://github.com/wadewegner/salesforce-cli-bash-completion
# LICENSE: https://github.com/wadewegner/salesforce-cli-bash-completion/blob/master/LICENSE
if ! type __ltrim_colon_completions >/dev/null 2>&1; then
# Copyright © 2006-2008, Ian Macdonald <[email protected]>
# © 2009-2017, Bash Completion Maintainers
__ltrim_colon_completions() {
# If word-to-complete contains a colon,
# and bash-version < 4,
# or bash-version >= 4 and COMP_WORDBREAKS contains a colon
if [[
"$1" == *:* && (
${BASH_VERSINFO[0]} -lt 4 ||
(${BASH_VERSINFO[0]} -ge 4 && "$COMP_WORDBREAKS" == *:*)
)
]]; then
# Remove colon-word prefix from COMPREPLY items
local colon_word=${1%${1##*:}}
local i=${#COMPREPLY[*]}
while [ $((--i)) -ge 0 ]; do
COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}
done
fi
}
fi
_sfdx()
{
local cur
local prev
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
local -a words=(
force:alias:list \
force:alias:set \
force:apex:class:create \
force:apex:execute \
force:apex:log:get \
force:apex:log:list \
force:apex:log:tail \
force:apex:test:report \
force:apex:test:run \
force:apex:trigger:create \
force:auth:device:login \
force:auth:jwt:grant \
force:auth:list \
force:auth:logout \
force:auth:sfdxurl:store \
force:auth:web:login \
force:config:get \
force:config:list \
force:config:set \
force:data:bulk:delete \
force:data:bulk:status \
force:data:bulk:upsert \
force:data:record:create \
force:data:record:delete \
force:data:record:get \
force:data:record:update \
force:data:soql:query \
force:data:tree:export \
force:data:tree:import \
force:doc:commands:display \
force:doc:commands:list \
force:lightning:app:create \
force:lightning:component:create \
force:lightning:event:create \
force:lightning:interface:create \
force:lightning:lint \
force:lightning:test:create \
force:lightning:test:install \
force:lightning:test:run \
force:limits:api:display \
force:mdapi:convert \
force:mdapi:deploy \
force:mdapi:deploy:cancel \
force:mdapi:deploy:report \
force:mdapi:describemetadata \
force:mdapi:listmetadata \
force:mdapi:retrieve \
force:mdapi:retrieve:report \
force:org:clone \
force:org:create \
force:org:delete \
force:org:display \
force:org:list \
force:org:open \
force:org:shape:create \
force:org:shape:delete \
force:org:shape:list \
force:org:snapshot:create \
force:org:snapshot:delete \
force:org:snapshot:get \
force:org:snapshot:list \
force:org:status \
force:package1:version:create \
force:package1:version:create:get \
force:package1:version:display \
force:package1:version:list \
force:package:create \
force:package:hammertest:list \
force:package:hammertest:report \
force:package:hammertest:run \
force:package:install \
force:package:install:report \
force:package:installed:list \
force:package:list \
force:package:uninstall \
force:package:uninstall:report \
force:package:update \
force:package:version:create \
force:package:version:create:list \
force:package:version:create:report \
force:package:version:list \
force:package:version:promote \
force:package:version:report \
force:package:version:update \
force:project:create \
force:project:upgrade \
force:schema:sobject:describe \
force:schema:sobject:list \
force:source:convert \
force:source:delete \
force:source:deploy \
force:source:deploy:cancel \
force:source:deploy:report \
force:source:open \
force:source:pull \
force:source:push \
force:source:retrieve \
force:source:status \
force:user:create \
force:user:display \
force:user:list \
force:user:password:generate \
force:user:permset:assign \
force:visualforce:component:create \
force:visualforce:page:create \
plugins:install \
plugins:link \
plugins:install \
plugins:uninstall \
plugins:update \
update
)
case "$prev" in
sfdx)
COMPREPLY=( $(compgen -W "${words[*]}" -- $cur))
__ltrim_colon_completions "$cur"
;;
*)
# return to normal completion
COMPREPLY=()
;;
esac
return 0
}
complete -o default -F _sfdx sfdx