_frontend-search.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. 'qunit: Search in Qunit website'
  36. 'reactjs: Search in React website'
  37. 'smacss: Search in SMACSS website'
  38. 'stackoverflow: Search in StackOverflow website'
  39. 'typescript: Search in TypeScript website'
  40. 'unheap: Search in unheap website'
  41. 'vuejs: Search in VueJS website'
  42. )
  43. _arguments -C \
  44. '1: :->first_arg' \
  45. '2: :->second_arg' && ret=0
  46. case $state in
  47. first_arg)
  48. _describe -t frontend_points "Warp points" frontend_points && ret=0
  49. _describe -t commands "Commands" commands && ret=0
  50. ;;
  51. second_arg)
  52. case $words[2] in
  53. jquery)
  54. _describe -t points "Warp points" frontend_points && ret=0
  55. ;;
  56. mdn)
  57. _describe -t points "Warp points" frontend_points && ret=0
  58. ;;
  59. compassdoc)
  60. _describe -t points "Warp points" frontend_points && ret=0
  61. ;;
  62. html5please)
  63. _describe -t points "Warp points" frontend_points && ret=0
  64. ;;
  65. caniuse)
  66. _describe -t points "Warp points" frontend_points && ret=0
  67. ;;
  68. dartlang)
  69. _describe -t points "Warp points" frontend_points && ret=0
  70. ;;
  71. lodash)
  72. _describe -t points "Warp points" frontend_points && ret=0
  73. ;;
  74. qunit)
  75. _describe -t points "Warp points" frontend_points && ret=0
  76. ;;
  77. fontello)
  78. _describe -t points "Warp points" frontend_points && ret=0
  79. ;;
  80. github)
  81. _describe -t points "Warp points" frontend_points && ret=0
  82. ;;
  83. bootsnipp)
  84. _describe -t points "Warp points" frontend_points && ret=0
  85. ;;
  86. cssflow)
  87. _describe -t points "Warp points" frontend_points && ret=0
  88. ;;
  89. codepen)
  90. _describe -t points "Warp points" frontend_points && ret=0
  91. ;;
  92. unheap)
  93. _describe -t points "Warp points" frontend_points && ret=0
  94. ;;
  95. bem)
  96. _describe -t points "Warp points" frontend_points && ret=0
  97. ;;
  98. smacss)
  99. _describe -t points "Warp points" frontend_points && ret=0
  100. ;;
  101. angularjs)
  102. _describe -t points "Warp points" frontend_points && ret=0
  103. ;;
  104. reactjs)
  105. _describe -t points "Warp points" frontend_points && ret=0
  106. ;;
  107. emberjs)
  108. _describe -t points "Warp points" frontend_points && ret=0
  109. ;;
  110. stackoverflow)
  111. _describe -t points "Warp points" frontend_points && ret=0
  112. ;;
  113. npmjs)
  114. _describe -t points "Warp points" frontend_points && ret=0
  115. ;;
  116. bundlephobia)
  117. _describe -t points "Warp points" frontend_points && ret=0
  118. ;;
  119. flowtype)
  120. _describe -t points "Warp points" frontend_points && ret=0
  121. ;;
  122. typescript)
  123. _describe -t points "Warp points" frontend_points && ret=0
  124. ;;
  125. vuejs)
  126. _describe -t points "Warp points" frontend_points && ret=0
  127. ;;
  128. nodejs)
  129. _describe -t points "Warp points" frontend_points && ret=0
  130. ;;
  131. jestjs)
  132. _describe -t points "Warp points" frontend_points && ret=0
  133. ;;
  134. esac
  135. ;;
  136. esac
  137. return $ret
  138. }
  139. _frontend "$@"
  140. # Local Variables:
  141. # mode: Shell-Script
  142. # sh-indentation: 2
  143. # indent-tabs-mode: nil
  144. # sh-basic-offset: 2
  145. # End:
  146. # vim: ft=zsh sw=2 ts=2 et