diff --git a/completion/available/truffle.completion.bash b/completion/available/truffle.completion.bash new file mode 100644 index 00000000..eb591e27 --- /dev/null +++ b/completion/available/truffle.completion.bash @@ -0,0 +1,61 @@ +# shellcheck shell=bash + +__truffle_completion() { + local prev=$(_get_pword) + local curr=$(_get_cword) + + case $prev in + compile) + COMPREPLY=(--{list,all,network,quiet}) + ;; + config) + COMPREPLY=(--{enable,disable}-analytics get set list) + ;; + console) + COMPREPLY=(--{network,verbose-rpc}) + ;; + create) + COMPREPLY=(contract migration test all) + ;; + dashboard) + COMPREPLY=(--{port,host,verbose}) + ;; + debug) + COMPREPLY=(--{network,url,fetch-external,compile-{tests,all}}) + ;; + develop) + COMPREPLY=(--log) + ;; + exec) + COMPREPLY=(--{network,compile}) + ;; + debug) + COMPREPLY=(--force) + ;; + migrate) + COMPREPLY=(--{reset,f,to,network,compile-all,verbose-rpc,{,skip-}dry-run,interactive,describe-json}) + ;; + networks) + COMPREPLY=(--clean) + ;; + obtain) + COMPREPLY=(--solc) + ;; + preserve) + COMPREPLY=(--{ipfs,file-coin,environment,}) + ;; + unbox) + COMPREPLY=(--force) + ;; + test) + COMPREPLY=(--{compile-all{,-debug},network,verbose-rpc,show-events,debug{,-global},bail,stacktrace{,-extra}}) + ;; + truffle) + COMPREPLY=(build compile config console create dashboard browser db debug deploy develop exec help init install migrate networks obtain opcode preserve publish run test unbox version watch) + ;; + esac +} + +if _command_exists truffle; then + complete -F __truffle_completion -X "!&*" truffle +fi