hookapp 0.0.7 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/LICENSE.md +31 -0
- data/OVERVIEW.md +80 -0
- data/README.md +282 -21
- data/Rakefile +1 -1
- data/bin/hook +127 -10
- data/buildnotes.md +29 -0
- data/hook.rdoc +63 -4
- data/hookapp.gemspec +9 -8
- data/html/App.html +119 -0
- data/html/GLI.html +99 -0
- data/html/GLI/Commands.html +99 -0
- data/html/GLI/Commands/Doc.html +99 -0
- data/html/GLI/Commands/MarkdownDocumentListener.html +717 -0
- data/html/Hook.html +113 -0
- data/html/HookApp.html +1222 -0
- data/html/Hooker.html +119 -0
- data/html/README_rdoc.html +328 -0
- data/html/String.html +427 -0
- data/html/created.rid +9 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +619 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +308 -0
- data/html/js/darkfish.js +84 -0
- data/html/js/navigation.js +105 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +110 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +409 -0
- data/lib/completion/hook_completion.bash +22 -0
- data/lib/completion/hook_completion.fish +31 -0
- data/lib/completion/hook_completion.zsh +22 -0
- data/lib/helpers/fuzzyfilefinder +0 -0
- data/lib/hook.rb +5 -1
- data/lib/hook/hookapp.rb +489 -0
- data/lib/hook/hooker.rb +1 -344
- data/lib/hook/markdown_document_listener.rb +164 -0
- data/lib/hook/string.rb +60 -0
- data/lib/hook/version.rb +3 -1
- metadata +76 -12
Binary file
|
@@ -0,0 +1,409 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>Table of Contents - hookapp</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="./js/navigation.js" defer></script>
|
15
|
+
<script src="./js/search.js" defer></script>
|
16
|
+
<script src="./js/search_index.js" defer></script>
|
17
|
+
<script src="./js/searcher.js" defer></script>
|
18
|
+
<script src="./js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
<body id="top" class="table-of-contents">
|
27
|
+
<main role="main">
|
28
|
+
<h1 class="class">Table of Contents - hookapp</h1>
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
<h2 id="pages">Pages</h2>
|
33
|
+
<ul>
|
34
|
+
|
35
|
+
<li class="file">
|
36
|
+
<a href="README_rdoc.html">README</a>
|
37
|
+
|
38
|
+
<ul>
|
39
|
+
|
40
|
+
<li><a href="README_rdoc.html#label-hookapp">hookapp</a>
|
41
|
+
|
42
|
+
<li><a href="README_rdoc.html#label-hook+-+CLI+interface+for+Hook.app+-28macOS-29">hook - CLI interface for Hook.app (macOS)</a>
|
43
|
+
|
44
|
+
<li><a href="README_rdoc.html#label-Global+Options">Global Options</a>
|
45
|
+
|
46
|
+
<li><a href="README_rdoc.html#label--help">–help</a>
|
47
|
+
|
48
|
+
<li><a href="README_rdoc.html#label--version">–version</a>
|
49
|
+
|
50
|
+
<li><a href="README_rdoc.html#label-Commands">Commands</a>
|
51
|
+
|
52
|
+
<li><a href="README_rdoc.html#label-Command-3A+clip-7Ccp++FILE_OR_URL">Command: <code>clip|cp FILE_OR_URL</code></a>
|
53
|
+
|
54
|
+
<li><a href="README_rdoc.html#label-Options">Options</a>
|
55
|
+
|
56
|
+
<li><a href="README_rdoc.html#label-a-7C--app+APP_NAME">-a|–app APP_NAME</a>
|
57
|
+
|
58
|
+
<li><a href="README_rdoc.html#label-m-7C--markdown">-m|–markdown</a>
|
59
|
+
|
60
|
+
<li><a href="README_rdoc.html#label-Command-3A+clone++SOURCE+TARGET">Command: <code>clone SOURCE TARGET</code></a>
|
61
|
+
|
62
|
+
<li><a href="README_rdoc.html#label-Command-3A+find-7Csearch++SEARCH_STRING">Command: <code>find|search SEARCH_STRING</code></a>
|
63
|
+
|
64
|
+
<li><a href="README_rdoc.html#label-Options">Options</a>
|
65
|
+
|
66
|
+
<li><a href="README_rdoc.html#label-o-7C--output_format+format">-o|–output_format format</a>
|
67
|
+
|
68
|
+
<li><a href="README_rdoc.html#label-f-7C--files_only">-f|–files_only</a>
|
69
|
+
|
70
|
+
<li><a href="README_rdoc.html#label-n-7C--names_only">-n|–names_only</a>
|
71
|
+
|
72
|
+
<li><a href="README_rdoc.html#label--null">–null</a>
|
73
|
+
|
74
|
+
<li><a href="README_rdoc.html#label-Command-3A+from++APPLICATION_NAME">Command: <code>from APPLICATION_NAME</code></a>
|
75
|
+
|
76
|
+
<li><a href="README_rdoc.html#label-Options">Options</a>
|
77
|
+
|
78
|
+
<li><a href="README_rdoc.html#label-c-7C--copy">-c|–copy</a>
|
79
|
+
|
80
|
+
<li><a href="README_rdoc.html#label-m-7C--markdown">-m|–markdown</a>
|
81
|
+
|
82
|
+
<li><a href="README_rdoc.html#label-Command-3A+help++command">Command: <code>help command</code></a>
|
83
|
+
|
84
|
+
<li><a href="README_rdoc.html#label-Options">Options</a>
|
85
|
+
|
86
|
+
<li><a href="README_rdoc.html#label-c">-c</a>
|
87
|
+
|
88
|
+
<li><a href="README_rdoc.html#label-Command-3A+link-7Cln++SOURCE+-5BSOURCE...-5D+TARGET">Command: <code>link|ln SOURCE [SOURCE...] TARGET</code></a>
|
89
|
+
|
90
|
+
<li><a href="README_rdoc.html#label-Options">Options</a>
|
91
|
+
|
92
|
+
<li><a href="README_rdoc.html#label-a-7C--all">-a|–all</a>
|
93
|
+
|
94
|
+
<li><a href="README_rdoc.html#label-p-7C--paste">-p|–paste</a>
|
95
|
+
|
96
|
+
<li><a href="README_rdoc.html#label-Command-3A+list-7Cls++FILE_OR_URL+-5BFILE_OR_URL...-5D">Command: <code>list|ls FILE_OR_URL [FILE_OR_URL...]</code></a>
|
97
|
+
|
98
|
+
<li><a href="README_rdoc.html#label-Options">Options</a>
|
99
|
+
|
100
|
+
<li><a href="README_rdoc.html#label-o-7C--output_format+format">-o|–output_format format</a>
|
101
|
+
|
102
|
+
<li><a href="README_rdoc.html#label-f-7C--files_only">-f|–files_only</a>
|
103
|
+
|
104
|
+
<li><a href="README_rdoc.html#label--null">–null</a>
|
105
|
+
|
106
|
+
<li><a href="README_rdoc.html#label-s-7C--select">-<a href="no-">s|–</a>select</a>
|
107
|
+
|
108
|
+
<li><a href="README_rdoc.html#label-Command-3A+open-7Cgui++FILE_OR_URL">Command: <code>open|gui FILE_OR_URL</code></a>
|
109
|
+
|
110
|
+
<li><a href="README_rdoc.html#label-Command-3A+remove-7Crm++ITEM_1+ITEM_2">Command: <code>remove|rm ITEM_1 ITEM_2</code></a>
|
111
|
+
|
112
|
+
<li><a href="README_rdoc.html#label-Options">Options</a>
|
113
|
+
|
114
|
+
<li><a href="README_rdoc.html#label-a-7C--all">-a|–all</a>
|
115
|
+
|
116
|
+
<li><a href="README_rdoc.html#label-Command-3A+scripts++SHELL">Command: <code>scripts SHELL</code></a>
|
117
|
+
|
118
|
+
<li><a href="README_rdoc.html#label-Command-3A+select++FILE_OR_URL">Command: <code>select FILE_OR_URL</code></a>
|
119
|
+
|
120
|
+
</ul>
|
121
|
+
|
122
|
+
</li>
|
123
|
+
|
124
|
+
</ul>
|
125
|
+
|
126
|
+
|
127
|
+
<h2 id="classes">Classes and Modules</h2>
|
128
|
+
<ul>
|
129
|
+
|
130
|
+
<li class="class">
|
131
|
+
<a href="App.html">App</a>
|
132
|
+
|
133
|
+
</li>
|
134
|
+
|
135
|
+
<li class="module">
|
136
|
+
<a href="GLI.html">GLI</a>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
<li class="module">
|
141
|
+
<a href="GLI/Commands.html">GLI::Commands</a>
|
142
|
+
|
143
|
+
</li>
|
144
|
+
|
145
|
+
<li class="module">
|
146
|
+
<a href="GLI/Commands/Doc.html">GLI::Commands::Doc</a>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
<li class="class">
|
151
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html">GLI::Commands::MarkdownDocumentListener</a>
|
152
|
+
|
153
|
+
</li>
|
154
|
+
|
155
|
+
<li class="module">
|
156
|
+
<a href="Hook.html">Hook</a>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
<li class="module">
|
161
|
+
<a href="HookApp.html">HookApp</a>
|
162
|
+
|
163
|
+
</li>
|
164
|
+
|
165
|
+
<li class="class">
|
166
|
+
<a href="Hooker.html">Hooker</a>
|
167
|
+
|
168
|
+
</li>
|
169
|
+
|
170
|
+
<li class="class">
|
171
|
+
<a href="String.html">String</a>
|
172
|
+
|
173
|
+
</li>
|
174
|
+
|
175
|
+
</ul>
|
176
|
+
|
177
|
+
<h2 id="methods">Methods</h2>
|
178
|
+
<ul>
|
179
|
+
|
180
|
+
<li class="method">
|
181
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-c-new">::new</a>
|
182
|
+
—
|
183
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
184
|
+
|
185
|
+
<li class="method">
|
186
|
+
<a href="HookApp.html#method-i-all_bookmarks">#all_bookmarks</a>
|
187
|
+
—
|
188
|
+
<span class="container">HookApp</span>
|
189
|
+
|
190
|
+
<li class="method">
|
191
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-beginning">#beginning</a>
|
192
|
+
—
|
193
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
194
|
+
|
195
|
+
<li class="method">
|
196
|
+
<a href="HookApp.html#method-i-bookmark_for">#bookmark_for</a>
|
197
|
+
—
|
198
|
+
<span class="container">HookApp</span>
|
199
|
+
|
200
|
+
<li class="method">
|
201
|
+
<a href="HookApp.html#method-i-bookmark_from_app">#bookmark_from_app</a>
|
202
|
+
—
|
203
|
+
<span class="container">HookApp</span>
|
204
|
+
|
205
|
+
<li class="method">
|
206
|
+
<a href="String.html#method-i-cap">#cap</a>
|
207
|
+
—
|
208
|
+
<span class="container">String</span>
|
209
|
+
|
210
|
+
<li class="method">
|
211
|
+
<a href="String.html#method-i-cap-21">#cap!</a>
|
212
|
+
—
|
213
|
+
<span class="container">String</span>
|
214
|
+
|
215
|
+
<li class="method">
|
216
|
+
<a href="String.html#method-i-clip">#clip</a>
|
217
|
+
—
|
218
|
+
<span class="container">String</span>
|
219
|
+
|
220
|
+
<li class="method">
|
221
|
+
<a href="HookApp.html#method-i-clip_bookmark">#clip_bookmark</a>
|
222
|
+
—
|
223
|
+
<span class="container">HookApp</span>
|
224
|
+
|
225
|
+
<li class="method">
|
226
|
+
<a href="HookApp.html#method-i-clone_hooks">#clone_hooks</a>
|
227
|
+
—
|
228
|
+
<span class="container">HookApp</span>
|
229
|
+
|
230
|
+
<li class="method">
|
231
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-command">#command</a>
|
232
|
+
—
|
233
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
234
|
+
|
235
|
+
<li class="method">
|
236
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-commands">#commands</a>
|
237
|
+
—
|
238
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
239
|
+
|
240
|
+
<li class="method">
|
241
|
+
<a href="HookApp.html#method-i-copy_bookmark">#copy_bookmark</a>
|
242
|
+
—
|
243
|
+
<span class="container">HookApp</span>
|
244
|
+
|
245
|
+
<li class="method">
|
246
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-default_command">#default_command</a>
|
247
|
+
—
|
248
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
249
|
+
|
250
|
+
<li class="method">
|
251
|
+
<a href="HookApp.html#method-i-delete_all_hooks">#delete_all_hooks</a>
|
252
|
+
—
|
253
|
+
<span class="container">HookApp</span>
|
254
|
+
|
255
|
+
<li class="method">
|
256
|
+
<a href="HookApp.html#method-i-delete_hooks">#delete_hooks</a>
|
257
|
+
—
|
258
|
+
<span class="container">HookApp</span>
|
259
|
+
|
260
|
+
<li class="method">
|
261
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-end_command">#end_command</a>
|
262
|
+
—
|
263
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
264
|
+
|
265
|
+
<li class="method">
|
266
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-end_commands">#end_commands</a>
|
267
|
+
—
|
268
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
269
|
+
|
270
|
+
<li class="method">
|
271
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-end_options">#end_options</a>
|
272
|
+
—
|
273
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
274
|
+
|
275
|
+
<li class="method">
|
276
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-ending">#ending</a>
|
277
|
+
—
|
278
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
279
|
+
|
280
|
+
<li class="method">
|
281
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-flag">#flag</a>
|
282
|
+
—
|
283
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
284
|
+
|
285
|
+
<li class="method">
|
286
|
+
<a href="HookApp.html#method-i-format_regex">#format_regex</a>
|
287
|
+
—
|
288
|
+
<span class="container">HookApp</span>
|
289
|
+
|
290
|
+
<li class="method">
|
291
|
+
<a href="HookApp.html#method-i-get_hooks">#get_hooks</a>
|
292
|
+
—
|
293
|
+
<span class="container">HookApp</span>
|
294
|
+
|
295
|
+
<li class="method">
|
296
|
+
<a href="HookApp.html#method-i-link_all">#link_all</a>
|
297
|
+
—
|
298
|
+
<span class="container">HookApp</span>
|
299
|
+
|
300
|
+
<li class="method">
|
301
|
+
<a href="HookApp.html#method-i-link_files">#link_files</a>
|
302
|
+
—
|
303
|
+
<span class="container">HookApp</span>
|
304
|
+
|
305
|
+
<li class="method">
|
306
|
+
<a href="HookApp.html#method-i-linked_bookmarks">#linked_bookmarks</a>
|
307
|
+
—
|
308
|
+
<span class="container">HookApp</span>
|
309
|
+
|
310
|
+
<li class="method">
|
311
|
+
<a href="String.html#method-i-nil_if_missing">#nil_if_missing</a>
|
312
|
+
—
|
313
|
+
<span class="container">String</span>
|
314
|
+
|
315
|
+
<li class="method">
|
316
|
+
<a href="HookApp.html#method-i-open_gui">#open_gui</a>
|
317
|
+
—
|
318
|
+
<span class="container">HookApp</span>
|
319
|
+
|
320
|
+
<li class="method">
|
321
|
+
<a href="HookApp.html#method-i-open_linked">#open_linked</a>
|
322
|
+
—
|
323
|
+
<span class="container">HookApp</span>
|
324
|
+
|
325
|
+
<li class="method">
|
326
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-options">#options</a>
|
327
|
+
—
|
328
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
329
|
+
|
330
|
+
<li class="method">
|
331
|
+
<a href="HookApp.html#method-i-output_array">#output_array</a>
|
332
|
+
—
|
333
|
+
<span class="container">HookApp</span>
|
334
|
+
|
335
|
+
<li class="method">
|
336
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-program_desc">#program_desc</a>
|
337
|
+
—
|
338
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
339
|
+
|
340
|
+
<li class="method">
|
341
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-program_long_desc">#program_long_desc</a>
|
342
|
+
—
|
343
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
344
|
+
|
345
|
+
<li class="method">
|
346
|
+
<a href="HookApp.html#method-i-search_bookmarks">#search_bookmarks</a>
|
347
|
+
—
|
348
|
+
<span class="container">HookApp</span>
|
349
|
+
|
350
|
+
<li class="method">
|
351
|
+
<a href="HookApp.html#method-i-search_name">#search_name</a>
|
352
|
+
—
|
353
|
+
<span class="container">HookApp</span>
|
354
|
+
|
355
|
+
<li class="method">
|
356
|
+
<a href="HookApp.html#method-i-search_path_or_address">#search_path_or_address</a>
|
357
|
+
—
|
358
|
+
<span class="container">HookApp</span>
|
359
|
+
|
360
|
+
<li class="method">
|
361
|
+
<a href="HookApp.html#method-i-select_hook">#select_hook</a>
|
362
|
+
—
|
363
|
+
<span class="container">HookApp</span>
|
364
|
+
|
365
|
+
<li class="method">
|
366
|
+
<a href="String.html#method-i-split_hook">#split_hook</a>
|
367
|
+
—
|
368
|
+
<span class="container">String</span>
|
369
|
+
|
370
|
+
<li class="method">
|
371
|
+
<a href="String.html#method-i-split_hooks">#split_hooks</a>
|
372
|
+
—
|
373
|
+
<span class="container">String</span>
|
374
|
+
|
375
|
+
<li class="method">
|
376
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-switch">#switch</a>
|
377
|
+
—
|
378
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
379
|
+
|
380
|
+
<li class="method">
|
381
|
+
<a href="String.html#method-i-valid_hook">#valid_hook</a>
|
382
|
+
—
|
383
|
+
<span class="container">String</span>
|
384
|
+
|
385
|
+
<li class="method">
|
386
|
+
<a href="String.html#method-i-valid_hook-21">#valid_hook!</a>
|
387
|
+
—
|
388
|
+
<span class="container">String</span>
|
389
|
+
|
390
|
+
<li class="method">
|
391
|
+
<a href="HookApp.html#method-i-validate_format">#validate_format</a>
|
392
|
+
—
|
393
|
+
<span class="container">HookApp</span>
|
394
|
+
|
395
|
+
<li class="method">
|
396
|
+
<a href="GLI/Commands/MarkdownDocumentListener.html#method-i-version">#version</a>
|
397
|
+
—
|
398
|
+
<span class="container">GLI::Commands::MarkdownDocumentListener</span>
|
399
|
+
|
400
|
+
</ul>
|
401
|
+
</main>
|
402
|
+
|
403
|
+
|
404
|
+
<footer id="validator-badges" role="contentinfo">
|
405
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
406
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
407
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
408
|
+
</footer>
|
409
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Source this script from ~/.bash_profile
|
2
|
+
_hook_targets()
|
3
|
+
{
|
4
|
+
local cmds cur ff
|
5
|
+
if (($COMP_CWORD == 1))
|
6
|
+
then
|
7
|
+
cur="${COMP_WORDS[1]}"
|
8
|
+
cmds="$(hook help -c)"
|
9
|
+
COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
|
10
|
+
COMPREPLY=( "${COMPREPLY[@]/%/ }" )
|
11
|
+
else
|
12
|
+
# get all matching files and directories
|
13
|
+
COMPREPLY=($(compgen -f -- "${COMP_WORDS[$COMP_CWORD]}"))
|
14
|
+
|
15
|
+
for ((ff=0; ff<${#COMPREPLY[@]}; ff++)); do
|
16
|
+
[[ -d ${COMPREPLY[$ff]} ]] && COMPREPLY[$ff]+='/'
|
17
|
+
[[ -f ${COMPREPLY[$ff]} ]] && COMPREPLY[$ff]+=' '
|
18
|
+
done
|
19
|
+
fi
|
20
|
+
}
|
21
|
+
|
22
|
+
complete -o bashdefault -o default -o nospace -F _hook_targets hook
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Save this script in ~/.config/fish/completions/hook.fish
|
2
|
+
function __fish_hook_needs_command
|
3
|
+
# Figure out if the current invocation already has a command.
|
4
|
+
|
5
|
+
set -l opts h-help v-version
|
6
|
+
set cmd (commandline -opc)
|
7
|
+
set -e cmd[1]
|
8
|
+
argparse -s $opts -- $cmd 2>/dev/null
|
9
|
+
or return 0
|
10
|
+
# These flags function as commands, effectively.
|
11
|
+
if set -q argv[1]
|
12
|
+
# Also print the command, so this can be used to figure out what it is.
|
13
|
+
echo $argv[1]
|
14
|
+
return 1
|
15
|
+
end
|
16
|
+
return 0
|
17
|
+
end
|
18
|
+
|
19
|
+
function __fish_hook_using_command
|
20
|
+
set -l cmd (__fish_hook_needs_command)
|
21
|
+
test -z "$cmd"
|
22
|
+
and return 1
|
23
|
+
contains -- $cmd $argv
|
24
|
+
and return 0
|
25
|
+
end
|
26
|
+
|
27
|
+
function __fish_hook_subcommands
|
28
|
+
hook help -c
|
29
|
+
end
|
30
|
+
|
31
|
+
complete -xc hook -n '__fish_hook_needs_command' -a '(__fish_hook_subcommands)'
|