_frontend-search.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #compdef frontend
  2. zstyle ':completion:*:descriptions' format '%B%d%b'
  3. zstyle ':completion::complete:frontend:*:commands' group-name commands
  4. zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points
  5. zstyle ':completion::complete:frontend::' list-grouped
  6. zmodload zsh/mapfile
  7. function _frontend() {
  8. local CONFIG=$HOME/.frontend-search
  9. local ret=1
  10. local -a commands
  11. local -a frontend_points
  12. frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
  13. commands=(
  14. 'angular: Search in Angular.io website'
  15. 'angularjs: Search in docs.angularjs.org website'
  16. 'bem: Search in BEM website'
  17. 'bootsnipp: Search in bootsnipp website'
  18. 'bundlephobia: Search in Bundlephobia website'
  19. 'caniuse: Search in Can I Use website'
  20. 'codepen: Search in codepen website'
  21. 'compassdoc: Search in COMPASS website'
  22. 'cssflow: Search in cssflow website'
  23. 'dartlang: Search in Dart website'
  24. 'emberjs: Search in Ember website'
  25. 'flowtype: Search in Flowtype website'
  26. 'fontello: Search in fontello website'
  27. 'github: Search in GitHub website'
  28. 'html5please: Search in HTML5 Please website'
  29. 'jestjs: Search in Jest website'
  30. 'jquery: Search in jQuery website'
  31. 'lodash: Search in Lo-Dash website'
  32. 'mdn: Search in MDN website'
  33. 'nodejs: Search in NodeJS website'
  34. 'npmjs: Search in NPMJS website'
  35. 'packagephobia: Search in Packagephobia website'
  36. 'qunit: Search in Qunit website'
  37. 'reactjs: Search in React website'
  38. 'smacss: Search in SMACSS website'
  39. 'stackoverflow: Search in StackOverflow website'
  40. 'typescript: Search in TypeScript website'
  41. 'unheap: Search in unheap website'
  42. 'vuejs: Search in VueJS website'
  43. )
  44. _arguments -C \
  45. '1: :->first_arg' \
  46. '2: :->second_arg' && ret=0
  47. case $state in
  48. first_arg)
  49. _describe -t frontend_points "Warp points" frontend_points && ret=0
  50. _describe -t commands "Commands" commands && ret=0
  51. ;;
  52. second_arg)
  53. case $words[2] in
  54. jquery)
  55. _describe -t points "Warp points" frontend_points && ret=0
  56. ;;
  57. mdn)
  58. _describe -t points "Warp points" frontend_points && ret=0
  59. ;;
  60. compassdoc)
  61. _describe -t points "Warp points" frontend_points && ret=0
  62. ;;
  63. html5please)
  64. _describe -t points "Warp points" frontend_points && ret=0
  65. ;;
  66. caniuse)
  67. _describe -t points "Warp points" frontend_points && ret=0
  68. ;;
  69. dartlang)
  70. _describe -t points "Warp points" frontend_points && ret=0
  71. ;;
  72. lodash)
  73. _describe -t points "Warp points" frontend_points && ret=0
  74. ;;
  75. qunit)
  76. _describe -t points "Warp points" frontend_points && ret=0
  77. ;;
  78. fontello)
  79. _describe -t points "Warp points" frontend_points && ret=0
  80. ;;
  81. github)
  82. _describe -t points "Warp points" frontend_points && ret=0
  83. ;;
  84. bootsnipp)
  85. _describe -t points "Warp points" frontend_points && ret=0
  86. ;;
  87. cssflow)
  88. _describe -t points "Warp points" frontend_points && ret=0
  89. ;;
  90. codepen)
  91. _describe -t points "Warp points" frontend_points && ret=0
  92. ;;
  93. unheap)
  94. _describe -t points "Warp points" frontend_points && ret=0
  95. ;;
  96. bem)
  97. _describe -t points "Warp points" frontend_points && ret=0
  98. ;;
  99. smacss)
  100. _describe -t points "Warp points" frontend_points && ret=0
  101. ;;
  102. angularjs)
  103. _describe -t points "Warp points" frontend_points && ret=0
  104. ;;
  105. reactjs)
  106. _describe -t points "Warp points" frontend_points && ret=0
  107. ;;
  108. emberjs)
  109. _describe -t points "Warp points" frontend_points && ret=0
  110. ;;
  111. stackoverflow)
  112. _describe -t points "Warp points" frontend_points && ret=0
  113. ;;
  114. npmjs)
  115. _describe -t points "Warp points" frontend_points && ret=0
  116. ;;
  117. bundlephobia)
  118. _describe -t points "Warp points" frontend_points && ret=0
  119. ;;
  120. packagephobia)
  121. _describe -t points "Warp points" frontend_points && ret=0
  122. ;;
  123. flowtype)
  124. _describe -t points "Warp points" frontend_points && ret=0
  125. ;;
  126. typescript)
  127. _describe -t points "Warp points" frontend_points && ret=0
  128. ;;
  129. vuejs)
  130. _describe -t points "Warp points" frontend_points && ret=0
  131. ;;
  132. nodejs)
  133. _describe -t points "Warp points" frontend_points && ret=0
  134. ;;
  135. jestjs)
  136. _describe -t points "Warp points" frontend_points && ret=0
  137. ;;
  138. esac
  139. ;;
  140. esac
  141. return $ret
  142. }
  143. _frontend "$@"
  144. # Local Variables:
  145. # mode: Shell-Script
  146. # sh-indentation: 2
  147. # indent-tabs-mode: nil
  148. # sh-basic-offset: 2
  149. # End:
  150. # vim: ft=zsh sw=2 ts=2 et