Skip to content

Commit

Permalink
Fixed issues with normal tab completion after command
Browse files Browse the repository at this point in the history
  • Loading branch information
wadewegner committed Jan 18, 2018
1 parent 1d08b91 commit 56489f3
Showing 1 changed file with 104 additions and 5 deletions.
109 changes: 104 additions & 5 deletions sfdx.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,114 @@ fi
_sfdx()
{
local cur
local words
local prev

cur="${COMP_WORDS[COMP_CWORD]}"
words='force:alias:list force:alias:set force:apex:class:create force:apex:execute force:apex:log:get force:apex:log:list force:apex:test:report force:apex:test:run force:apex:trigger:create force:auth:jwt:grant 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:report force:mdapi:retrieve force:mdapi:retrieve:report 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:package1:version:create force:package1:version:create:get force:package1:version:display force:package1:version:list force:package2:create force:package2:list force:package2:update force:package2:version:create force:package2:version:create:get force:package2:version:create:list force:package2:version:get force:package2:version:list force:package2:version:update force:package:install force:package:install:get force:package:installed:list force:package:uninstall force:package:uninstall:get force:project:create force:project:upgrade force:schema:sobject:describe force:schema:sobject:list force:source:convert force:source:open force:source:pull force:source:push 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'
prev="${COMP_WORDS[COMP_CWORD-1]}"

COMPREPLY=( $(compgen -W '$words' -- $cur))
__ltrim_colon_completions "$cur"
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:test:report \
force:apex:test:run \
force:apex:trigger:create \
force:auth:jwt:grant \
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:report \
force:mdapi:retrieve \
force:mdapi:retrieve:report \
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:package1:version:create \
force:package1:version:create:get \
force:package1:version:display \
force:package1:version:list \
force:package2:create \
force:package2:list \
force:package2:update \
force:package2:version:create \
force:package2:version:create:get \
force:package2:version:create:list \
force:package2:version:get \
force:package2:version:list \
force:package2:version:update \
force:package:install \
force:package:install:get \
force:package:installed:list \
force:package:uninstall \
force:package:uninstall:get \
force:project:create \
force:project:upgrade \
force:schema:sobject:describe \
force:schema:sobject:list \
force:source:convert \
force:source:open \
force:source:pull \
force:source:push \
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 \
)

case "$prev" in
sfdx)
COMPREPLY=( $(compgen -W "${words[*]}" -- $cur))
__ltrim_colon_completions "$cur"
;;
*)
COMPREPLY=($(compgen -f -- "${COMP_WORDS[${COMP_CWORD}]}" ))

for ((ff=0; ff<${#COMPREPLY[@]}; ff++)); do
test -d "${COMPREPLY[$ff]}" && COMPREPLY[$ff]="${COMPREPLY[$ff]}/"
test -f "${COMPREPLY[$ff]}" && COMPREPLY[$ff]="${COMPREPLY[$ff]} "
done

;;
esac

return 0
}

complete -F _sfdx sfdx
complete -o bashdefault -o nospace -F _sfdx sfdx

0 comments on commit 56489f3

Please sign in to comment.