goctl自动补全

goctl 自动补全仅支持 unix-like 操作系统

用法

  1. $ goctl completion -h
  2. NAME:
  3. goctl completion - generation completion script, it only works for unix-like OS
  4. USAGE:
  5. goctl completion [command options] [arguments...]
  6. OPTIONS:
  7. --name value, -n value the filename of auto complete script, default is [goctl_autocomplete]

生成自动补全文件

  1. $ goctl completion
  2. generation auto completion success!
  3. executes the following script to setting shell:
  4. echo PROG=goctl source /Users/keson/.goctl/.auto_complete/zsh/goctl_autocomplete >> ~/.zshrc && source ~/.zshrc
  5. or
  6. echo PROG=goctl source /Users/keson/.goctl/.auto_complete/bash/goctl_autocomplete >> ~/.bashrc && source ~/.bashrc

shell 配置

  • zsh
    1. $ echo PROG=goctl source /Users/keson/.goctl/.auto_complete/zsh/goctl_autocomplete >> ~/.zshrc && source ~/.zshrc
  • bash
    1. $ echo PROG=goctl source /Users/keson/.goctl/.auto_complete/bash/goctl_autocomplete >> ~/.bashrc && source ~/.bashrc

演示效果

使用 tab 键出现自动补全提示

  1. $ goctl
  2. api -- generate api related files
  3. bug -- report a bug
  4. completion -- generation completion script, it only works for unix-like OS
  5. docker -- generate Dockerfile
  6. help h -- Shows a list of commands or help for one command
  7. kube -- generate kubernetes files
  8. migrate -- migrate from tal-tech to zeromicro
  9. model -- generate model code
  10. rpc -- generate rpc code
  11. template -- template operation
  12. upgrade -- upgrade goctl to latest version