_spring 593 B

1234567891011121314151617181920212223242526272829
  1. #compdef spring 'spring'
  2. #autoload
  3. _spring() {
  4. local cword
  5. let cword=CURRENT-1
  6. local hints
  7. hints=()
  8. local reply
  9. while read -r line; do
  10. reply=`echo "$line" | awk '{printf $1 ":"; for (i=2; i<NF; i++) printf $i " "; print $NF}'`
  11. hints+=("$reply")
  12. done < <(spring hint ${cword} ${words[*]})
  13. if ((cword == 1)) {
  14. _describe -t commands 'commands' hints
  15. return 0
  16. }
  17. _describe -t options 'options' hints
  18. _files
  19. return 0
  20. }
  21. _spring "$@"