summaryrefslogtreecommitdiff
path: root/plugins/frontend-search/_frontend
blob: aca4920d7473475518bec07e80fd6085a4451f1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#compdef frontend

zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion::complete:frontend:*:commands' group-name commands
zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points
zstyle ':completion::complete:frontend::' list-grouped

zmodload zsh/mapfile

function _frontend() {
  local CONFIG=$HOME/.frontend-search
  local ret=1

  local -a commands
  local -a frontend_points

  frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )

  commands=(
    'angular: Search in Angular.io website'
    'angularjs: Search in docs.angularjs.org website'
    'bem: Search in BEM website'
    'bootsnipp: Search in bootsnipp website'
    'bundlephobia: Search in Bundlephobia website'
    'caniuse: Search in Can I Use website'
    'codepen: Search in codepen website'
    'compassdoc: Search in COMPASS website'
    'cssflow: Search in cssflow website'
    'dartlang: Search in Dart website'
    'emberjs: Search in Ember website'
    'flowtype: Search in Flowtype website'
    'fontello: Search in fontello website'
    'github: Search in GitHub website'
    'html5please: Search in HTML5 Please website'
    'jestjs: Search in Jest website'
    'jquery: Search in jQuery website'
    'lodash: Search in Lo-Dash website'
    'mdn: Search in MDN website'
    'nodejs: Search in NodeJS website'
    'npmjs: Search in npmjs website'
    'packagephobia: Search in Packagephobia website'
    'qunit: Search in Qunit website'
    'reactjs: Search in React website'
    'smacss: Search in SMACSS website'
    'stackoverflow: Search in StackOverflow website'
    'typescript: Search in TypeScript website'
    'unheap: Search in unheap website'
    'vuejs: Search in VueJS website'
  )

  _arguments -C \
    '1: :->first_arg' \
    '2: :->second_arg' && ret=0

  case $state in
    first_arg)
      _describe -t frontend_points "Warp points" frontend_points && ret=0
      _describe -t commands "Commands" commands && ret=0
      ;;
    second_arg)
      case $words[2] in
        jquery)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        mdn)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        compassdoc)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        html5please)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        caniuse)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        dartlang)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        lodash)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        qunit)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        fontello)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        github)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        bootsnipp)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        cssflow)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        codepen)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        unheap)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        bem)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        smacss)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        angularjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        reactjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        emberjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        stackoverflow)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        npmjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        bundlephobia)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        packagephobia)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        flowtype)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        typescript)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        vuejs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        nodejs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        jestjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
      esac
      ;;
  esac

  return $ret
}

_frontend "$@"

# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et