hookapp 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS.md +4 -0
  3. data/CHANGELOG.md +5 -0
  4. data/LICENSE +21 -0
  5. data/README.md +31 -21
  6. data/bin/hook +57 -67
  7. data/hook.rdoc +15 -10
  8. data/html/App.html +107 -0
  9. data/html/GLI/Commands/Doc.html +91 -0
  10. data/html/GLI/Commands/MarkdownDocumentListener.html +521 -0
  11. data/html/GLI/Commands.html +91 -0
  12. data/html/GLI.html +91 -0
  13. data/html/Hook.html +100 -0
  14. data/html/HookApp.html +1002 -0
  15. data/html/Hooker.html +141 -0
  16. data/html/README_rdoc.html +354 -0
  17. data/html/String.html +335 -0
  18. data/html/created.rid +9 -0
  19. data/html/css/fonts.css +167 -0
  20. data/html/css/rdoc.css +639 -0
  21. data/html/fonts/Lato-Light.ttf +0 -0
  22. data/html/fonts/Lato-LightItalic.ttf +0 -0
  23. data/html/fonts/Lato-Regular.ttf +0 -0
  24. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  25. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  26. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  27. data/html/images/add.png +0 -0
  28. data/html/images/arrow_up.png +0 -0
  29. data/html/images/brick.png +0 -0
  30. data/html/images/brick_link.png +0 -0
  31. data/html/images/bug.png +0 -0
  32. data/html/images/bullet_black.png +0 -0
  33. data/html/images/bullet_toggle_minus.png +0 -0
  34. data/html/images/bullet_toggle_plus.png +0 -0
  35. data/html/images/date.png +0 -0
  36. data/html/images/delete.png +0 -0
  37. data/html/images/find.png +0 -0
  38. data/html/images/loadingAnimation.gif +0 -0
  39. data/html/images/macFFBgHack.png +0 -0
  40. data/html/images/package.png +0 -0
  41. data/html/images/page_green.png +0 -0
  42. data/html/images/page_white_text.png +0 -0
  43. data/html/images/page_white_width.png +0 -0
  44. data/html/images/plugin.png +0 -0
  45. data/html/images/ruby.png +0 -0
  46. data/html/images/tag_blue.png +0 -0
  47. data/html/images/tag_green.png +0 -0
  48. data/html/images/transparent.png +0 -0
  49. data/html/images/wrench.png +0 -0
  50. data/html/images/wrench_orange.png +0 -0
  51. data/html/images/zoom.png +0 -0
  52. data/html/index.html +317 -0
  53. data/html/js/darkfish.js +84 -0
  54. data/html/js/navigation.js +105 -0
  55. data/html/js/navigation.js.gz +0 -0
  56. data/html/js/search.js +110 -0
  57. data/html/js/search_index.js +1 -0
  58. data/html/js/search_index.js.gz +0 -0
  59. data/html/js/searcher.js +229 -0
  60. data/html/js/searcher.js.gz +0 -0
  61. data/html/table_of_contents.html +365 -0
  62. data/lib/hook/hookapp.rb +9 -10
  63. data/lib/hook/markdown_document_listener.rb +12 -2
  64. data/lib/hook/version.rb +1 -1
  65. data/test/hook_scripts_test.rb +1 -1
  66. metadata +58 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 477033a68381137c2a2c67a486896da5d1210fb8d261950beff09df64b0b6566
4
- data.tar.gz: b3de73462923bc91c88c7ab58b3c8fc7195ffe19cb4d09bef2acd3d0e579e7d5
3
+ metadata.gz: 17971d6f699aa3ec68b8b4d9903b112858c04484747c15117cea24b90839a4c9
4
+ data.tar.gz: 3b4551d1d1553e4c70129341848584a1542bc4af7c00e2cacb1dd6bf540bf514
5
5
  SHA512:
6
- metadata.gz: c64691a5a0ddc289590408efd13936e352962838f182ec905dfd8ac706197e6f5538d2cbe2a108b1a72f7ace459d90d36d1b789cf48bc7a6871391c871698a24
7
- data.tar.gz: 3b91f789621f9cf091793ac75d9d44b61c09c2c07ae34fc4e84495ee670c2016c8583b71d00c067917f12aff77e603b389773a1cf4acb8a3a12bcd9cea2ac1bb
6
+ metadata.gz: ad634683684e623978d4b60ad22beea237e228ae9ff3dc999e50e0083e2eba59b192a9e928e26057082d23124e2714c7f41b68ebb0ab68320239611959c521b9
7
+ data.tar.gz: 336ee727add0a904bbf81a97e4327596e0936af32dd7bb66b6cf580ba9d35828212ee7c18a1ec8d87841c1edd7a20d1c30e24f8f2d7803bdcc8dd66986dd3f92
data/AUTHORS.md ADDED
@@ -0,0 +1,4 @@
1
+ ## Authors
2
+
3
+ - Brett Terpstra <me@brettterpstra.com>
4
+ - Josh Nichols <joshua.nichols@gmail.com>
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ #### 2.0.8
2
+
3
+ - Bug fixes
4
+ - New tests
5
+
1
6
  #### 2.0.3
2
7
 
3
8
  - Incorporate `fzf` for selecting and filtering hooks
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,7 +3,8 @@
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.
6
+
7
+ This gem includes a `hook` binary that allows interaction with the features of Hook.app.
7
8
 
8
9
  *v2.0.7*
9
10
 
@@ -100,13 +101,13 @@ Display the program version
100
101
 
101
102
  ## Commands
102
103
 
103
- ### `$ hook` <mark>`clip|cp`</mark> ` FILE_OR_URL`
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> ` SOURCE TARGET`
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. Exactly two arguments (SOURCE, TARGET) required.
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> ` SEARCH_STRING`
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` 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> ` APPLICATION_NAME`
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> ` command`
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> ` SOURCE [SOURCE...] TARGET`
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> ` FILE_OR_URL [FILE_OR_URL...]`
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` 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> ` FILE_OR_URL`
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. Exactly one argument (File/URL) required.
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> ` STRING`
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> ` STRING`
274
+ ##### `$ hook` <mark>`percent decode`</mark> `STRING`
270
275
 
271
276
  *decode a percent-encoded string*
272
277
 
273
- ##### `$ hook` <mark>`encode`</mark> ` STRING`
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> ` ITEM_1 ITEM_2`
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> ` SHELL`
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> ` FILE_OR_URL`
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 2021-09-25 07:37
361
+ Documentation generated 2021-09-26 07:50
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
- This gem includes a `hook` binary that allows interaction with the features of Hook.app.'
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
- arg_name 'FILE_OR_URL [FILE_OR_URL...]'
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.flag %i[o output_format], { arg_name: 'format', default_value: 'paths' }
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
- return hookapp.open_linked(args[0])
52
- end
53
- valid_format = hookapp.validate_format(options[:o], valid_formats)
54
- exit_now!("Invalid output format: \"#{options[:o]}\"", 6) unless valid_format
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
- result = hookapp.linked_bookmarks(args, { files_only: options[:f],
57
- format: valid_format,
58
- null_separator: options[:null] })
56
+ result = hookapp.linked_bookmarks(args, { files_only: options[:f],
57
+ format: valid_format,
58
+ null_separator: options[:null] })
59
59
 
60
- puts result
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
- exit_now!("Invalid number of arguments, (expected 1)", 5)
74
+ help_now!('Invalid number of arguments, (expected 1)', 5)
76
75
  elsif args.nil? || args.empty?
77
- exit_now!("Specify a shell (#{valid_shells.join(', ')})", 0)
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
- if valid_shells.include?(args[0])
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: 'format', default_value: 'paths' }
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 [SOURCE...] TARGET'
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
- Copy all the files and urls that the first file is hooked to onto another file. Exactly two arguments (SOURCE, TARGET) required.
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
- exit_now!("Wrong number of arguments. One file path or url required (#{args.length} given)", 5) if args.length != 1
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
- Opens Hook.app on the specified file/URL for browsing and performing actions. Exactly one argument (File/URL) required.
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
- exit_now!("Wrong number of arguments. One file path or url required (#{args.length} given)", 5) if args.length != 1
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 %{Use encode or decode to apply Hook's url encoding to a string argument. Use '-' to read input from STDIN.}
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
- exit_now!('no string provided') unless args.size.positive?
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
- exit_now! ('no string provided') unless args.size.positive?
288
+ help_now!('no string provided') unless args.size.positive?
299
289
 
300
290
  string = args.join(' ').strip
301
291
  end
data/hook.rdoc CHANGED
@@ -1,7 +1,8 @@
1
1
  == hook - CLI interface for Hook.app (macOS)
2
2
 
3
3
  Hook.app is a productivity tool for macOS <https://hookproductivity.com/>.
4
- This gem includes a `hook` binary that allows interaction with the features of Hook.app.
4
+
5
+ This gem includes a `hook` binary that allows interaction with the features of Hook.app.
5
6
 
6
7
  v2.0.7
7
8
 
@@ -22,7 +23,7 @@ Copy Hook URL for file/url to clipboard
22
23
 
23
24
  Creates a bookmark for the specified file or URL and copies its Hook URL to the clipboard.
24
25
 
25
- The copied Hook URL can be used to link to other files (use `hook link --paste FILE/URL),
26
+ The copied Hook URL can be used to link to other files (use `hook link --paste FILE/URL`,
26
27
  or to paste into another app as a link. Use the -m flag to copy a full Markdown link.
27
28
  ===== Options
28
29
  ===== -a|--app APP_NAME
@@ -40,15 +41,17 @@ Copy as Markdown
40
41
  ==== Command: <tt>clone SOURCE TARGET</tt>
41
42
  Clone all hooks from one file or url onto another
42
43
 
43
- Copy all the files and urls that the first file is hooked to onto another file. Exactly two arguments (SOURCE, TARGET) required.
44
- ==== Command: <tt>find|search SEARCH_STRING</tt>
44
+ Copy all the files and urls that the first file is hooked to onto another file.
45
+
46
+ Exactly two arguments (SOURCE, TARGET) required.
47
+ ==== Command: <tt>find|search [SEARCH_STRING]</tt>
45
48
  Search bookmarks
46
49
 
47
50
  Search bookmark urls and names for a string and output in specified format (default "paths").
48
51
 
49
52
  Run `hook find` with no search argument to list all bookmarks.
50
53
  ===== Options
51
- ===== -o|--output_format format
54
+ ===== -o|--output_format FORMAT
52
55
 
53
56
  Output format [(h)ooks, (p)aths, (m)arkdown, (v)erbose]
54
57
 
@@ -98,7 +101,7 @@ List commands one per line, to assist with shell completion
98
101
 
99
102
 
100
103
 
101
- ==== Command: <tt>link|ln SOURCE [SOURCE...] TARGET</tt>
104
+ ==== Command: <tt>link|ln SOURCE... TARGET</tt>
102
105
  Create bidirectional hooks between two or more files/urls
103
106
 
104
107
  If two files/urls are provided, links will be bi-directional.
@@ -119,14 +122,14 @@ Paste URL from clipboard
119
122
 
120
123
 
121
124
 
122
- ==== Command: <tt>list|ls FILE_OR_URL [FILE_OR_URL...]</tt>
125
+ ==== Command: <tt>list|ls [FILE_OR_URL]...</tt>
123
126
  List hooks on a file or url
124
127
 
125
128
  Output a list of all hooks attached to given url(s) or file(s) in the specified format (default "paths").
126
129
 
127
130
  Run `hook list` with no file/url argument to list all bookmarks.
128
131
  ===== Options
129
- ===== -o|--output_format format
132
+ ===== -o|--output_format FORMAT
130
133
 
131
134
  Output format [(h)ooks, (p)aths, (m)arkdown, (v)erbose]
132
135
 
@@ -151,7 +154,9 @@ This option is a shortcut to `hook select` and overrides any other arguments.
151
154
  ==== Command: <tt>open|gui FILE_OR_URL</tt>
152
155
  Open the specified file or url in Hook GUI
153
156
 
154
- Opens Hook.app on the specified file/URL for browsing and performing actions. Exactly one argument (File/URL) required.
157
+ Opens Hook.app on the specified file/URL for browsing and performing actions.
158
+
159
+ Exactly one argument (File/URL) required.
155
160
  ==== Command: <tt>percent STRING</tt>
156
161
  Percent encode/decode a string
157
162
 
@@ -165,7 +170,7 @@ decode a percent-encoded string
165
170
  percent encode a string
166
171
 
167
172
 
168
- ==== Command: <tt>remove|rm ITEM_1 ITEM_2</tt>
173
+ ==== Command: <tt>remove|rm FILE_OR_URL...</tt>
169
174
  Remove a hook between two files/urls
170
175
 
171
176
  Remove a hook between two files or URLs. If you use --all, all hooks on a given file will be removed.