hookapp 2.0.7 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHORS.md +4 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +35 -40
- data/LICENSE +21 -0
- data/README.md +32 -22
- data/bin/hook +57 -67
- data/hook.rdoc +16 -11
- data/hookapp.gemspec +1 -0
- data/html/App.html +107 -0
- data/html/GLI/Commands/Doc.html +91 -0
- data/html/GLI/Commands/MarkdownDocumentListener.html +521 -0
- data/html/GLI/Commands.html +91 -0
- data/html/GLI.html +91 -0
- data/html/Hook/Prompt.html +100 -0
- data/html/Hook/PromptFZF.html +243 -0
- data/html/Hook/PromptSTD.html +177 -0
- data/html/Hook.html +100 -0
- data/html/HookApp.html +1008 -0
- data/html/Hooker.html +141 -0
- data/html/README_rdoc.html +354 -0
- data/html/String.html +335 -0
- data/html/created.rid +10 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +639 -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 +320 -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/hook/hookapp.rb +11 -12
- data/lib/hook/hooker.rb +1 -0
- data/lib/hook/markdown_document_listener.rb +12 -2
- data/lib/hook/prompt.rb +113 -0
- data/lib/hook/version.rb +1 -1
- data/lib/hook.rb +2 -0
- data/test/hook_clip_test.rb +1 -1
- data/test/hook_link_test.rb +2 -1
- data/test/hook_scripts_test.rb +1 -1
- metadata +82 -3
- data/lib/helpers/fuzzyfilefinder +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 139ecb2e98a6f42e1499541fd62cc8b7605e4223874dec1ed843d05e50d15b9e
|
4
|
+
data.tar.gz: afe9d0893cb5ae49a2063228b74580801d78987ebbb4e4374b0bef8bfdd08fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ddb41793305f83f4f0b4b09abf4e27c35f19c9f97c23ff5c33a082ef94bec9445572c9481f831131770afaec6fd2c344700405a2bc801e37e5749b500fbfca7
|
7
|
+
data.tar.gz: d5020af5a886bd2df01839afc7dc642926307d077b8a36e89e520e420c55724dca7ead7626db0571e7f694c4d92231891a9a219f9b32f811dbe48e47c6581414
|
data/AUTHORS.md
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
#### 2.0.10
|
2
|
+
|
3
|
+
- Fix permissions issues when installed using sudo
|
4
|
+
|
5
|
+
#### 2.0.9
|
6
|
+
|
7
|
+
- Fix fzf integration across platforms
|
8
|
+
|
9
|
+
#### 2.0.8
|
10
|
+
|
11
|
+
- Bug fixes
|
12
|
+
- New tests
|
13
|
+
|
1
14
|
#### 2.0.3
|
2
15
|
|
3
16
|
- Incorporate `fzf` for selecting and filtering hooks
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hookapp (2.0.
|
4
|
+
hookapp (2.0.10)
|
5
5
|
gli (~> 2.20.1)
|
6
|
+
tty-which (~> 0.5, >= 0.5.0)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: http://rubygems.org/
|
@@ -17,53 +18,47 @@ GEM
|
|
17
18
|
builder (3.2.4)
|
18
19
|
childprocess (3.0.0)
|
19
20
|
contracts (0.17)
|
20
|
-
cucumber (
|
21
|
+
cucumber (8.0.0)
|
21
22
|
builder (~> 3.2, >= 3.2.4)
|
22
|
-
cucumber-
|
23
|
-
cucumber-
|
24
|
-
cucumber-cucumber-expressions (~>
|
25
|
-
cucumber-gherkin (~>
|
26
|
-
cucumber-html-formatter (~>
|
27
|
-
cucumber-messages (~>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
multi_test (~> 0.1, >= 0.1.2)
|
23
|
+
cucumber-ci-environment (~> 9.0, >= 9.0.4)
|
24
|
+
cucumber-core (~> 11.0, >= 11.0.0)
|
25
|
+
cucumber-cucumber-expressions (~> 15.1, >= 15.1.1)
|
26
|
+
cucumber-gherkin (~> 23.0, >= 23.0.1)
|
27
|
+
cucumber-html-formatter (~> 19.1, >= 19.1.0)
|
28
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
29
|
+
diff-lcs (~> 1.5, >= 1.5.0)
|
30
|
+
mime-types (~> 3.4, >= 3.4.1)
|
31
|
+
multi_test (~> 1.1, >= 1.1.0)
|
32
32
|
sys-uname (~> 1.2, >= 1.2.2)
|
33
|
-
cucumber-
|
34
|
-
|
35
|
-
cucumber-
|
36
|
-
cucumber-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
cucumber-
|
42
|
-
cucumber-messages (~>
|
43
|
-
cucumber-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
cucumber-wire (6.1.1)
|
48
|
-
cucumber-core (~> 10.0, >= 10.0.1)
|
49
|
-
cucumber-cucumber-expressions (~> 12.1, >= 12.1.2)
|
50
|
-
cucumber-messages (~> 17.0, >= 17.0.1)
|
51
|
-
diff-lcs (1.4.4)
|
52
|
-
ffi (1.15.4)
|
33
|
+
cucumber-ci-environment (9.0.4)
|
34
|
+
cucumber-core (11.0.0)
|
35
|
+
cucumber-gherkin (~> 23.0, >= 23.0.1)
|
36
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
37
|
+
cucumber-tag-expressions (~> 4.1, >= 4.1.0)
|
38
|
+
cucumber-cucumber-expressions (15.2.0)
|
39
|
+
cucumber-gherkin (23.0.1)
|
40
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
41
|
+
cucumber-html-formatter (19.1.0)
|
42
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
43
|
+
cucumber-messages (18.0.0)
|
44
|
+
cucumber-tag-expressions (4.1.0)
|
45
|
+
diff-lcs (1.5.0)
|
46
|
+
ffi (1.15.5)
|
53
47
|
gli (2.20.1)
|
54
|
-
mime-types (3.
|
48
|
+
mime-types (3.4.1)
|
55
49
|
mime-types-data (~> 3.2015)
|
56
|
-
mime-types-data (3.
|
57
|
-
multi_test (
|
50
|
+
mime-types-data (3.2022.0105)
|
51
|
+
multi_test (1.1.0)
|
58
52
|
rake (13.0.6)
|
59
|
-
rdoc (6.3.
|
60
|
-
rspec-expectations (3.
|
53
|
+
rdoc (6.3.3)
|
54
|
+
rspec-expectations (3.11.0)
|
61
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-support (3.
|
56
|
+
rspec-support (~> 3.11.0)
|
57
|
+
rspec-support (3.11.0)
|
64
58
|
sys-uname (1.2.2)
|
65
59
|
ffi (~> 1.1)
|
66
|
-
thor (1.1
|
60
|
+
thor (1.2.1)
|
61
|
+
tty-which (0.5.0)
|
67
62
|
|
68
63
|
PLATFORMS
|
69
64
|
ruby
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Brett Terpstra
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
CLI interface for Hook.app (macOS)
|
4
4
|
|
5
5
|
> Hook.app is a productivity tool for macOS <https://hookproductivity.com/>.
|
6
|
-
This gem includes a `hook` binary that allows interaction with the features of Hook.app.
|
7
6
|
|
8
|
-
|
7
|
+
This gem includes a `hook` binary that allows interaction with the features of Hook.app.
|
8
|
+
|
9
|
+
*v2.0.10*
|
9
10
|
|
10
11
|
## Installation
|
11
12
|
|
@@ -100,13 +101,13 @@ Display the program version
|
|
100
101
|
|
101
102
|
## Commands
|
102
103
|
|
103
|
-
### `$ hook` <mark>`clip|cp`</mark> `
|
104
|
+
### `$ hook` <mark>`clip|cp`</mark> `FILE_OR_URL`
|
104
105
|
|
105
106
|
*Copy Hook URL for file/url to clipboard*
|
106
107
|
|
107
108
|
> Creates a bookmark for the specified file or URL and copies its Hook URL to the clipboard.
|
108
109
|
>
|
109
|
-
> The copied Hook URL can be used to link to other files (use `hook link --paste FILE/URL
|
110
|
+
> The copied Hook URL can be used to link to other files (use `hook link --paste FILE/URL`,
|
110
111
|
> or to paste into another app as a link. Use the -m flag to copy a full Markdown link.
|
111
112
|
|
112
113
|
#### Options
|
@@ -121,15 +122,17 @@ Copy as Markdown
|
|
121
122
|
|
122
123
|
* * * * * *
|
123
124
|
|
124
|
-
### `$ hook` <mark>`clone`</mark> `
|
125
|
+
### `$ hook` <mark>`clone`</mark> `SOURCE TARGET`
|
125
126
|
|
126
127
|
*Clone all hooks from one file or url onto another*
|
127
128
|
|
128
|
-
> Copy all the files and urls that the first file is hooked to onto another file.
|
129
|
+
> Copy all the files and urls that the first file is hooked to onto another file.
|
130
|
+
>
|
131
|
+
> Exactly two arguments (SOURCE, TARGET) required.
|
129
132
|
|
130
133
|
* * * * * *
|
131
134
|
|
132
|
-
### `$ hook` <mark>`find|search`</mark> `
|
135
|
+
### `$ hook` <mark>`find|search`</mark> `[SEARCH_STRING]`
|
133
136
|
|
134
137
|
*Search bookmarks*
|
135
138
|
|
@@ -139,7 +142,7 @@ Copy as Markdown
|
|
139
142
|
|
140
143
|
#### Options
|
141
144
|
|
142
|
-
##### `-o` | `--output_format`
|
145
|
+
##### `-o` | `--output_format` FORMAT
|
143
146
|
|
144
147
|
Output format [(h)ooks, (p)aths, (m)arkdown, (v)erbose]
|
145
148
|
|
@@ -159,7 +162,7 @@ Separate results with NULL separator, only applies with "paths" output for singl
|
|
159
162
|
|
160
163
|
* * * * * *
|
161
164
|
|
162
|
-
### `$ hook` <mark>`from`</mark> `
|
165
|
+
### `$ hook` <mark>`from`</mark> `APPLICATION_NAME`
|
163
166
|
|
164
167
|
*Get a Hook URL for the frontmost window of an app*
|
165
168
|
|
@@ -180,7 +183,7 @@ Output as Markdown
|
|
180
183
|
|
181
184
|
* * * * * *
|
182
185
|
|
183
|
-
### `$ hook` <mark>`help`</mark> `
|
186
|
+
### `$ hook` <mark>`help`</mark> `command`
|
184
187
|
|
185
188
|
*Shows a list of commands or help for one command*
|
186
189
|
|
@@ -194,7 +197,7 @@ List commands one per line, to assist with shell completion
|
|
194
197
|
|
195
198
|
* * * * * *
|
196
199
|
|
197
|
-
### `$ hook` <mark>`link|ln`</mark> `
|
200
|
+
### `$ hook` <mark>`link|ln`</mark> `SOURCE... TARGET`
|
198
201
|
|
199
202
|
*Create bidirectional hooks between two or more files/urls*
|
200
203
|
|
@@ -218,7 +221,7 @@ Paste URL from clipboard
|
|
218
221
|
|
219
222
|
* * * * * *
|
220
223
|
|
221
|
-
### `$ hook` <mark>`list|ls`</mark> `
|
224
|
+
### `$ hook` <mark>`list|ls`</mark> `[FILE_OR_URL]...`
|
222
225
|
|
223
226
|
*List hooks on a file or url*
|
224
227
|
|
@@ -228,7 +231,7 @@ Paste URL from clipboard
|
|
228
231
|
|
229
232
|
#### Options
|
230
233
|
|
231
|
-
##### `-o` | `--output_format`
|
234
|
+
##### `-o` | `--output_format` FORMAT
|
232
235
|
|
233
236
|
Output format [(h)ooks, (p)aths, (m)arkdown, (v)erbose]
|
234
237
|
|
@@ -250,15 +253,17 @@ Generate a menu to select hook(s) for opening
|
|
250
253
|
|
251
254
|
* * * * * *
|
252
255
|
|
253
|
-
### `$ hook` <mark>`open|gui`</mark> `
|
256
|
+
### `$ hook` <mark>`open|gui`</mark> `FILE_OR_URL`
|
254
257
|
|
255
258
|
*Open the specified file or url in Hook GUI*
|
256
259
|
|
257
|
-
> Opens Hook.app on the specified file/URL for browsing and performing actions.
|
260
|
+
> Opens Hook.app on the specified file/URL for browsing and performing actions.
|
261
|
+
>
|
262
|
+
> Exactly one argument (File/URL) required.
|
258
263
|
|
259
264
|
* * * * * *
|
260
265
|
|
261
|
-
### `$ hook` <mark>`percent`</mark> `
|
266
|
+
### `$ hook` <mark>`percent`</mark> `STRING`
|
262
267
|
|
263
268
|
*Percent encode/decode a string*
|
264
269
|
|
@@ -266,17 +271,17 @@ Generate a menu to select hook(s) for opening
|
|
266
271
|
|
267
272
|
#### Commands
|
268
273
|
|
269
|
-
##### `$ hook` <mark>`decode`</mark> `
|
274
|
+
##### `$ hook` <mark>`percent decode`</mark> `STRING`
|
270
275
|
|
271
276
|
*decode a percent-encoded string*
|
272
277
|
|
273
|
-
##### `$ hook` <mark>`encode`</mark> `
|
278
|
+
##### `$ hook` <mark>`percent encode`</mark> `STRING`
|
274
279
|
|
275
280
|
*percent encode a string*
|
276
281
|
|
277
282
|
* * * * * *
|
278
283
|
|
279
|
-
### `$ hook` <mark>`remove|rm`</mark> `
|
284
|
+
### `$ hook` <mark>`remove|rm`</mark> `FILE_OR_URL...`
|
280
285
|
|
281
286
|
*Remove a hook between two files/urls*
|
282
287
|
|
@@ -296,7 +301,7 @@ Remove ALL links on files, requires confirmation
|
|
296
301
|
|
297
302
|
* * * * * *
|
298
303
|
|
299
|
-
### `$ hook` <mark>`scripts`</mark> `
|
304
|
+
### `$ hook` <mark>`scripts`</mark> `SHELL`
|
300
305
|
|
301
306
|
*Shell completion examples*
|
302
307
|
|
@@ -304,7 +309,7 @@ Remove ALL links on files, requires confirmation
|
|
304
309
|
|
305
310
|
* * * * * *
|
306
311
|
|
307
|
-
### `$ hook` <mark>`select`</mark> `
|
312
|
+
### `$ hook` <mark>`select`</mark> `FILE_OR_URL`
|
308
313
|
|
309
314
|
*Select from hooks on a file/url and open in default application*
|
310
315
|
|
@@ -315,6 +320,11 @@ Remove ALL links on files, requires confirmation
|
|
315
320
|
* * * * * *
|
316
321
|
|
317
322
|
#### [Default Command] help
|
323
|
+
## Authors
|
324
|
+
|
325
|
+
- Brett Terpstra <me@brettterpstra.com>
|
326
|
+
- Josh Nichols <joshua.nichols@gmail.com>
|
327
|
+
|
318
328
|
## Credits
|
319
329
|
|
320
330
|
HookApp embeds [Fuzzy Finder](https://github.com/junegunn/fzf) under the [MIT License](https://github.com/junegunn/fzf/blob/master/LICENSE)
|
@@ -348,5 +358,5 @@ This software is licensed under the MIT License.
|
|
348
358
|
THE SOFTWARE.
|
349
359
|
|
350
360
|
|
351
|
-
Documentation generated
|
361
|
+
Documentation generated 2022-05-28 08:26
|
352
362
|
|
data/bin/hook
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
1
|
+
#!/usr/bin/env ruby -W1
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'hook'
|
@@ -10,7 +10,8 @@ class App
|
|
10
10
|
|
11
11
|
program_desc 'CLI interface for Hook.app (macOS)'
|
12
12
|
program_long_desc 'Hook.app is a productivity tool for macOS <https://hookproductivity.com/>.
|
13
|
-
|
13
|
+
|
14
|
+
This gem includes a `hook` binary that allows interaction with the features of Hook.app.'
|
14
15
|
default_command 'help'
|
15
16
|
autocomplete_commands = true
|
16
17
|
synopsis_format(:terminal)
|
@@ -24,12 +25,10 @@ class App
|
|
24
25
|
stdin = nil
|
25
26
|
|
26
27
|
desc 'List hooks on a file or url'
|
27
|
-
long_desc %
|
28
|
-
Output a list of all hooks attached to given url(s) or file(s) in the specified format (default "paths").
|
29
|
-
|
30
|
-
Run `hook list` with no file/url argument to list all bookmarks.}
|
28
|
+
long_desc %(Output a list of all hooks attached to given url(s) or file(s) in the specified format (default "paths").
|
31
29
|
|
32
|
-
|
30
|
+
Run `hook list` with no file/url argument to list all bookmarks.)
|
31
|
+
arg_name 'FILE_OR_URL', [:optional, :multiple]
|
33
32
|
command %i[list ls] do |c|
|
34
33
|
c.desc 'Generate a menu to select hook(s) for opening'
|
35
34
|
c.long_desc 'This option is a shortcut to `hook select` and overrides any other arguments.'
|
@@ -44,20 +43,22 @@ Run `hook list` with no file/url argument to list all bookmarks.}
|
|
44
43
|
valid_formats = %w[hooks paths markdown verbose]
|
45
44
|
fmt_list = valid_formats.map { |fmt| fmt.sub(/^(.)(.*?)$/, '(\1)\2') }.join(', ')
|
46
45
|
c.desc "Output format [#{fmt_list}]"
|
47
|
-
c.
|
46
|
+
c.arg_name 'FORMAT'
|
47
|
+
c.flag %i[o output_format], { arg_name: 'FORMAT', default_value: 'paths' }
|
48
48
|
|
49
49
|
c.action do |_global_options, options, args|
|
50
50
|
if options[:s]
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
hookapp.open_linked(args[0])
|
52
|
+
else
|
53
|
+
valid_format = hookapp.validate_format(options[:o], valid_formats)
|
54
|
+
help_now!("Invalid output format: \"#{options[:o]}\"", 6) unless valid_format
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
result = hookapp.linked_bookmarks(args, { files_only: options[:f],
|
57
|
+
format: valid_format,
|
58
|
+
null_separator: options[:null] })
|
59
59
|
|
60
|
-
|
60
|
+
puts result
|
61
|
+
end
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
@@ -65,25 +66,21 @@ Run `hook list` with no file/url argument to list all bookmarks.}
|
|
65
66
|
# the full shell name as the extension, e.g. "hook_completion.bash".
|
66
67
|
desc 'Shell completion examples'
|
67
68
|
valid_shells = %w[bash zsh fish]
|
68
|
-
long_desc %{
|
69
|
-
Output completion script example for the specified shell (#{valid_shells.join(', ')})
|
70
|
-
}
|
69
|
+
long_desc %(Output completion script example for the specified shell (#{valid_shells.join(', ')}))
|
71
70
|
arg_name 'SHELL'
|
72
71
|
command %i[scripts] do |c|
|
73
72
|
c.action do |_global_options, _options, args|
|
74
73
|
if args.length > 1
|
75
|
-
|
74
|
+
help_now!('Invalid number of arguments, (expected 1)', 5)
|
76
75
|
elsif args.nil? || args.empty?
|
77
|
-
|
76
|
+
help_now!("Specify a shell (#{valid_shells.join(', ')})", 0)
|
77
|
+
elsif valid_shells.include?(args[0])
|
78
|
+
base_dir = File.expand_path(File.join(File.dirname(__FILE__), '../lib/completion'))
|
79
|
+
completion = File.join(base_dir, "hook_completion.#{args[0]}")
|
80
|
+
script = IO.read(completion)
|
81
|
+
$stdout.puts script
|
78
82
|
else
|
79
|
-
|
80
|
-
base_dir = File.expand_path(File.join(File.dirname(__FILE__), '../lib/completion'))
|
81
|
-
completion = File.join(base_dir, "hook_completion.#{args[0]}")
|
82
|
-
script = IO.read(completion)
|
83
|
-
$stdout.puts script
|
84
|
-
else
|
85
|
-
exit_now!("Invalid shell name, must be one of #{valid_shells.join(', ')}", 1)
|
86
|
-
end
|
83
|
+
help_now!("Invalid shell name, must be one of #{valid_shells.join(', ')}", 1)
|
87
84
|
end
|
88
85
|
end
|
89
86
|
end
|
@@ -91,11 +88,10 @@ Output completion script example for the specified shell (#{valid_shells.join(',
|
|
91
88
|
|
92
89
|
|
93
90
|
desc 'Search bookmarks'
|
94
|
-
long_desc %
|
95
|
-
Search bookmark urls and names for a string and output in specified format (default "paths").
|
91
|
+
long_desc %(Search bookmark urls and names for a string and output in specified format (default "paths").
|
96
92
|
|
97
|
-
Run `hook find` with no search argument to list all bookmarks.
|
98
|
-
arg_name 'SEARCH_STRING'
|
93
|
+
Run `hook find` with no search argument to list all bookmarks.)
|
94
|
+
arg_name 'SEARCH_STRING', :optional
|
99
95
|
command %i[find search] do |c|
|
100
96
|
c.desc 'Output only bookmarks with file paths (exclude e.g. emails)'
|
101
97
|
c.switch %i[f files_only], { negatable: false, default_value: false }
|
@@ -107,7 +103,7 @@ Run `hook find` with no search argument to list all bookmarks.}
|
|
107
103
|
fmt_list = valid_formats.map { |fmt| fmt.sub(/^(.)(.*?)$/, '(\1)\2') }.join(', ')
|
108
104
|
|
109
105
|
c.desc "Output format [#{fmt_list}]"
|
110
|
-
c.flag %i[o output_format], { arg_name: '
|
106
|
+
c.flag %i[o output_format], { arg_name: 'FORMAT', default_value: 'paths' }
|
111
107
|
|
112
108
|
c.desc "Search only bookmark names"
|
113
109
|
c.switch %i[n names_only], { negatable: false, default_value: false }
|
@@ -126,16 +122,15 @@ Run `hook find` with no search argument to list all bookmarks.}
|
|
126
122
|
end
|
127
123
|
|
128
124
|
desc 'Create bidirectional hooks between two or more files/urls'
|
129
|
-
long_desc
|
130
|
-
If two files/urls are provided, links will be bi-directional.
|
125
|
+
long_desc 'If two files/urls are provided, links will be bi-directional.
|
131
126
|
If three or more are provided, `link` defaults to creating bi-directional
|
132
127
|
links between each file and the last file in the list. Use `-a` to create
|
133
128
|
bi-directional links between every file in the list.
|
134
129
|
|
135
130
|
If using `--paste`, the URL/hook link in the clipboard will be used as one argument,
|
136
131
|
to be combined with one or more file/url arguments.
|
137
|
-
|
138
|
-
arg_name 'SOURCE
|
132
|
+
'
|
133
|
+
arg_name 'SOURCE... TARGET'
|
139
134
|
command %i[link ln] do |c|
|
140
135
|
c.desc 'Link every listed file or url to every other'
|
141
136
|
c.switch %i[a all], { negatable: false, default_value: false }
|
@@ -161,12 +156,10 @@ to be combined with one or more file/url arguments.
|
|
161
156
|
end
|
162
157
|
|
163
158
|
desc 'Copy Hook URL for file/url to clipboard'
|
164
|
-
long_desc %{
|
165
|
-
Creates a bookmark for the specified file or URL and copies its Hook URL to the clipboard.
|
159
|
+
long_desc %{Creates a bookmark for the specified file or URL and copies its Hook URL to the clipboard.
|
166
160
|
|
167
|
-
The copied Hook URL can be used to link to other files (use `hook link --paste FILE/URL
|
168
|
-
or to paste into another app as a link. Use the -m flag to copy a full Markdown link.
|
169
|
-
}
|
161
|
+
The copied Hook URL can be used to link to other files (use `hook link --paste FILE/URL`,
|
162
|
+
or to paste into another app as a link. Use the -m flag to copy a full Markdown link.}
|
170
163
|
arg_name 'FILE_OR_URL'
|
171
164
|
command %i[clip cp] do |c|
|
172
165
|
c.desc 'Copy as Markdown'
|
@@ -187,12 +180,10 @@ or to paste into another app as a link. Use the -m flag to copy a full Markdown
|
|
187
180
|
end
|
188
181
|
|
189
182
|
desc 'Get a Hook URL for the frontmost window of an app'
|
190
|
-
long_desc %
|
191
|
-
Specify an application by name (without '.app') to bring that app to the foreground and create a bookmark
|
183
|
+
long_desc %(Specify an application by name (without '.app') to bring that app to the foreground and create a bookmark
|
192
184
|
for the active document, note, task, etc., returning a Hook URL.
|
193
185
|
|
194
|
-
Use -m to get the response as Markdown, and/or -c to copy the result directly to the clipboard.
|
195
|
-
}
|
186
|
+
Use -m to get the response as Markdown, and/or -c to copy the result directly to the clipboard.)
|
196
187
|
arg_name 'APPLICATION_NAME'
|
197
188
|
command %i[from] do |c|
|
198
189
|
c.desc 'Output as Markdown'
|
@@ -209,12 +200,10 @@ Use -m to get the response as Markdown, and/or -c to copy the result directly to
|
|
209
200
|
end
|
210
201
|
|
211
202
|
desc 'Remove a hook between two files/urls'
|
212
|
-
long_desc %
|
213
|
-
Remove a hook between two files or URLs. If you use --all, all hooks on a given file will be removed.
|
203
|
+
long_desc %(Remove a hook between two files or URLs. If you use --all, all hooks on a given file will be removed.
|
214
204
|
|
215
|
-
If --all isn't specified, exactly two arguments (Files/URLs) are required.
|
216
|
-
|
217
|
-
arg_name 'ITEM_1 ITEM_2'
|
205
|
+
If --all isn't specified, exactly two arguments (Files/URLs) are required.)
|
206
|
+
arg_name 'FILE_OR_URL', :multiple
|
218
207
|
command %i[remove rm] do |c|
|
219
208
|
c.desc 'Remove ALL links on files, requires confirmation'
|
220
209
|
c.switch %i[a all], { negatable: false, default_value: false }
|
@@ -227,9 +216,9 @@ If --all isn't specified, exactly two arguments (Files/URLs) are required.
|
|
227
216
|
end
|
228
217
|
|
229
218
|
desc 'Clone all hooks from one file or url onto another'
|
230
|
-
long_desc
|
231
|
-
|
232
|
-
|
219
|
+
long_desc 'Copy all the files and urls that the first file is hooked to onto another file.
|
220
|
+
|
221
|
+
Exactly two arguments (SOURCE, TARGET) required.'
|
233
222
|
arg_name 'SOURCE TARGET'
|
234
223
|
command %i[clone] do |c|
|
235
224
|
c.action do |_global_options, _options, args|
|
@@ -241,35 +230,36 @@ Copy all the files and urls that the first file is hooked to onto another file.
|
|
241
230
|
end
|
242
231
|
|
243
232
|
desc 'Select from hooks on a file/url and open in default application'
|
244
|
-
long_desc %
|
245
|
-
If the target file/URL has hooked items, a menu will be provided. Selecting one or more files
|
233
|
+
long_desc %(If the target file/URL has hooked items, a menu will be provided. Selecting one or more files
|
246
234
|
from this menu will open the item(s) using the default application assigned to the
|
247
|
-
filetype by macOS. Allows multiple selections with tab key, and type-ahead fuzzy filtering of results.
|
248
|
-
}
|
235
|
+
filetype by macOS. Allows multiple selections with tab key, and type-ahead fuzzy filtering of results.)
|
249
236
|
arg_name 'FILE_OR_URL'
|
250
237
|
command %i[select] do |c|
|
251
238
|
c.action do |_global_options, _options, args|
|
252
|
-
|
239
|
+
help_now!("Wrong number of arguments. One file path or url required (#{args.length} given)", 5) if args.length != 1
|
253
240
|
|
254
241
|
hookapp.open_linked(args[0])
|
255
242
|
end
|
256
243
|
end
|
257
244
|
|
258
245
|
desc 'Open the specified file or url in Hook GUI'
|
259
|
-
long_desc
|
260
|
-
|
261
|
-
|
246
|
+
long_desc 'Opens Hook.app on the specified file/URL for browsing and performing actions.
|
247
|
+
|
248
|
+
Exactly one argument (File/URL) required.'
|
262
249
|
arg_name 'FILE_OR_URL'
|
263
250
|
command %i[open gui] do |c|
|
264
251
|
c.action do |_global_options, _options, args|
|
265
|
-
|
252
|
+
if args.length != 1
|
253
|
+
help_now!("Wrong number of arguments. One file path
|
254
|
+
or url required (#{args.length} given)", 5)
|
255
|
+
end
|
266
256
|
|
267
257
|
hookapp.open_gui(args[0])
|
268
258
|
end
|
269
259
|
end
|
270
260
|
|
271
261
|
desc 'Percent encode/decode a string'
|
272
|
-
long_desc %
|
262
|
+
long_desc %(Use encode or decode to apply Hook's url encoding to a string argument. Use '-' to read input from STDIN.)
|
273
263
|
arg_name 'STRING'
|
274
264
|
command :percent do |c|
|
275
265
|
c.desc 'percent encode a string'
|
@@ -279,7 +269,7 @@ Opens Hook.app on the specified file/URL for browsing and performing actions. Ex
|
|
279
269
|
if stdin
|
280
270
|
string = stdin
|
281
271
|
else
|
282
|
-
|
272
|
+
help_now!('No string provided') unless args.size.positive?
|
283
273
|
|
284
274
|
string = args.join(' ').strip
|
285
275
|
end
|
@@ -295,7 +285,7 @@ Opens Hook.app on the specified file/URL for browsing and performing actions. Ex
|
|
295
285
|
if stdin
|
296
286
|
string = stdin
|
297
287
|
else
|
298
|
-
|
288
|
+
help_now!('no string provided') unless args.size.positive?
|
299
289
|
|
300
290
|
string = args.join(' ').strip
|
301
291
|
end
|