hookapp 0.0.2 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +61 -27
- data/README.md +26 -6
- data/bin/hook +31 -15
- data/hook.rdoc +28 -6
- data/hookapp.gemspec +3 -3
- data/lib/hook/hooker.rb +65 -29
- data/lib/hook/version.rb +1 -1
- metadata +20 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a875858589f000f0828cf170f68c6b0f13db7f3d2a10965fc08a76ee4fceb848
|
4
|
+
data.tar.gz: f2cff5c74c4dd9599d83faaa0f0723c5106b13f3bcb7c2726c9c750035fdf783
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977e7ddc4b1a2d5a99a9d7df21a614439c29cab22bdf1835d7e3ab68d819f7e69b06035a1d6064669dda7fe30f4af1d57d6c553e1bdf3cc8a2d4bebd329f45ce
|
7
|
+
data.tar.gz: 8eb0ee4b2cf9117133b04a0cbc3847f090365adac5b13ee79a38eb3e55e4e28eba5d1d37905ac82a478fa9b3f3d984e95343372706405eb98891281299163bfe
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#### 0.0.6
|
2
|
+
|
3
|
+
- Fix missing variable in clipboard functions
|
4
|
+
- Mv `cp` alias to mean `clip` instead of `clone`
|
5
|
+
|
6
|
+
#### 0.0.5
|
7
|
+
|
8
|
+
- `hook from APP_NAME` command
|
9
|
+
- General code cleanup
|
10
|
+
|
11
|
+
#### 0.0.4
|
12
|
+
|
13
|
+
- Fix "conversion of nil into string" error
|
14
|
+
|
15
|
+
#### 0.0.3
|
16
|
+
|
17
|
+
- Fix to handle all url types, not just hook: and http:
|
18
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hookapp (0.0.
|
4
|
+
hookapp (0.0.7)
|
5
5
|
gli (= 2.19.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
activesupport (6.0.3.2)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 0.7, < 2)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
10
16
|
aruba (0.14.14)
|
11
17
|
childprocess (>= 0.6.3, < 4.0.0)
|
12
18
|
contracts (~> 0.9)
|
@@ -14,48 +20,76 @@ GEM
|
|
14
20
|
ffi (~> 1.9)
|
15
21
|
rspec-expectations (>= 2.99)
|
16
22
|
thor (>= 0.19, < 2.0)
|
17
|
-
backports (3.17.0)
|
18
23
|
builder (3.2.4)
|
19
24
|
childprocess (3.0.0)
|
25
|
+
concurrent-ruby (1.1.6)
|
20
26
|
contracts (0.16.0)
|
21
|
-
cucumber (
|
22
|
-
builder (>= 2.
|
23
|
-
cucumber-core (~>
|
24
|
-
cucumber-
|
25
|
-
cucumber-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
cucumber (4.1.0)
|
28
|
+
builder (~> 3.2, >= 3.2.3)
|
29
|
+
cucumber-core (~> 7.1, >= 7.1.0)
|
30
|
+
cucumber-create-meta (~> 1.0.0, >= 1.0.0)
|
31
|
+
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
|
32
|
+
cucumber-gherkin (~> 14.0, >= 14.0.1)
|
33
|
+
cucumber-html-formatter (~> 7.0, >= 7.0.0)
|
34
|
+
cucumber-messages (~> 12.2, >= 12.2.0)
|
35
|
+
cucumber-wire (~> 3.1, >= 3.1.0)
|
36
|
+
diff-lcs (~> 1.3, >= 1.3, < 1.4)
|
37
|
+
multi_test (~> 0.1, >= 0.1.2)
|
38
|
+
sys-uname (~> 1.0, >= 1.0.2)
|
39
|
+
cucumber-core (7.1.0)
|
40
|
+
cucumber-gherkin (~> 14.0, >= 14.0.1)
|
41
|
+
cucumber-messages (~> 12.2, >= 12.2.0)
|
42
|
+
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
43
|
+
cucumber-create-meta (1.0.0)
|
44
|
+
cucumber-messages (~> 12.2, >= 12.2.0)
|
45
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
46
|
+
cucumber-cucumber-expressions (10.2.1)
|
47
|
+
cucumber-gherkin (14.0.1)
|
48
|
+
cucumber-messages (~> 12.2, >= 12.2.0)
|
49
|
+
cucumber-html-formatter (7.0.0)
|
50
|
+
cucumber-messages (~> 12.2, >= 12.2.0)
|
51
|
+
cucumber-messages (12.2.0)
|
52
|
+
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
53
|
+
cucumber-tag-expressions (2.0.4)
|
54
|
+
cucumber-wire (3.1.0)
|
55
|
+
cucumber-core (~> 7.1, >= 7.1.0)
|
56
|
+
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
|
57
|
+
cucumber-messages (~> 12.2, >= 12.2.0)
|
37
58
|
diff-lcs (1.3)
|
38
|
-
ffi (1.
|
39
|
-
gherkin (5.1.0)
|
59
|
+
ffi (1.13.1)
|
40
60
|
gli (2.19.0)
|
41
|
-
|
61
|
+
i18n (1.8.3)
|
62
|
+
concurrent-ruby (~> 1.0)
|
63
|
+
middleware (0.1.0)
|
64
|
+
minitest (5.14.1)
|
42
65
|
multi_test (0.1.2)
|
66
|
+
protobuf-cucumber (3.10.8)
|
67
|
+
activesupport (>= 3.2)
|
68
|
+
middleware
|
69
|
+
thor
|
70
|
+
thread_safe
|
43
71
|
rake (13.0.1)
|
44
|
-
rdoc (6.2
|
45
|
-
rspec-expectations (3.9.
|
72
|
+
rdoc (6.1.2)
|
73
|
+
rspec-expectations (3.9.2)
|
46
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
75
|
rspec-support (~> 3.9.0)
|
48
|
-
rspec-support (3.9.
|
76
|
+
rspec-support (3.9.3)
|
77
|
+
sys-uname (1.2.1)
|
78
|
+
ffi (>= 1.0.0)
|
49
79
|
thor (1.0.1)
|
80
|
+
thread_safe (0.3.6)
|
81
|
+
tzinfo (1.2.7)
|
82
|
+
thread_safe (~> 0.1)
|
83
|
+
zeitwerk (2.3.1)
|
50
84
|
|
51
85
|
PLATFORMS
|
52
86
|
ruby
|
53
87
|
|
54
88
|
DEPENDENCIES
|
55
|
-
aruba
|
89
|
+
aruba (~> 0.14.14)
|
56
90
|
hookapp!
|
57
|
-
rake
|
58
|
-
rdoc
|
91
|
+
rake (~> 13.0.1)
|
92
|
+
rdoc (~> 6.1.2)
|
59
93
|
|
60
94
|
BUNDLED WITH
|
61
95
|
2.1.4
|
data/README.md
CHANGED
@@ -4,11 +4,13 @@ A CLI for Hook.app on macOS.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
`gem install hookapp
|
7
|
+
`gem install hookapp`.
|
8
|
+
|
9
|
+
If you're on a stock Ruby install (i.e. have never installed `rvm` or `rbenv`), you may need sudo and your system password: `sudo gem install hookapp`.
|
8
10
|
|
9
11
|
## Usage
|
10
12
|
|
11
|
-
Run `hook help` for usage
|
13
|
+
Run `hook help` for usage.
|
12
14
|
|
13
15
|
NAME
|
14
16
|
hook - CLI interface for Hook.app (macOS)
|
@@ -24,8 +26,9 @@ Run `hook help` for usage:
|
|
24
26
|
--version - Display the program version
|
25
27
|
|
26
28
|
COMMANDS
|
27
|
-
clip
|
28
|
-
clone
|
29
|
+
clip, cp - Copy Hook URL for file/url to clipboard
|
30
|
+
clone - Clone all hooks from one file or url onto another
|
31
|
+
from - Get a Hook URL for the frontmost window of an app
|
29
32
|
help - Shows a list of commands or help for one command
|
30
33
|
link, ln - Create bidirectional hooks between two or more files/urls
|
31
34
|
list, ls - List hooks on a file or url
|
@@ -41,8 +44,25 @@ Run `hook help COMMAND` on any of the commands for more details.
|
|
41
44
|
|
42
45
|
The `link` command always creates bidirectional hooks. Give it two or more files or urls and it will create links between them. By default it links all files to the last file in the list. Add the `--all` flag to link all files to every other file in the list. This can be abbreviated as `hook ln -a file1.md file2.pdf "https://brettterpstra.com"`.
|
43
46
|
|
44
|
-
|
47
|
+
Similar to the way you would use the GUI, you can use `hook clip file1.md` to copy a Hook URL to the clipboard (aliased as `cp`), and then use `hook ln -p file2.pdf` to create a link from the clipboard to `file2.pdf`.
|
48
|
+
|
49
|
+
You can also clone all of the links on one file to another, great for adding a new file to a group that's fully crosslinked. Just use `hook clone file1.md file2.pdf`.
|
50
|
+
|
51
|
+
### Listing hooks
|
45
52
|
|
46
53
|
Use the `list` (aliased as `ls`) command to list all attached hooks for a file. With no output format specified, `ls` will show the paths to all hooks, or the hook url if the hook doesn't have a file path (e.g. a URL). You can specify an output format using `--output_format` (abbreviated as `-o`) with one of "markdown", "hooks", "paths", or "verbose". Formats can be abbreviated to their first letter, so to display a Markdown list of all hooked files, use `hook ls -o m file1.md`.
|
47
54
|
|
48
|
-
|
55
|
+
### Removing hooks
|
56
|
+
|
57
|
+
Use `hook remove file1.md file2.pdf` to remove the bidirectional link between `file1.md` and `file2.pdf`. Add the `--all` flag (abbr. `-a`) with one or more files to remove ALL the hooks on them. This option requires confirmation.
|
58
|
+
|
59
|
+
#### Super nerdy scripting trick
|
60
|
+
|
61
|
+
The `--output_format=paths` option (abbr. `-o p`) combined with the `--files_only` flag (abbr. `-f`) will list just the paths and only include hooks that have file paths (i.e. exclude web, email, and other URLs). This can be combined with `--null` to output the list using a NULL separator, perfect for use with `xargs` or other command line tools.
|
62
|
+
|
63
|
+
### Acting on hooks
|
64
|
+
|
65
|
+
You can open a hooked file or URL by running `hook select file1.md`. This will display a menu of all the hooks on `file1.md`, and entering the number of a selection will open that file in its default application.
|
66
|
+
|
67
|
+
You can also open a file in the Hook GUI using `hook open file1.md`.
|
68
|
+
|
data/bin/hook
CHANGED
@@ -17,16 +17,8 @@ class App
|
|
17
17
|
|
18
18
|
hooker = nil
|
19
19
|
|
20
|
-
# desc 'Describe some switch here'
|
21
|
-
# switch [:s,:switch]
|
22
|
-
|
23
|
-
# desc 'Describe some flag here'
|
24
|
-
# default_value 'the default'
|
25
|
-
# arg_name 'The name of the argument'
|
26
|
-
# flag [:f,:flagname]
|
27
|
-
|
28
20
|
desc 'List hooks on a file or url'
|
29
|
-
arg_name 'FILE_OR_URL [FILE_OR_URL
|
21
|
+
arg_name 'FILE_OR_URL [FILE_OR_URL...]'
|
30
22
|
command %i[list ls] do |c|
|
31
23
|
c.desc 'Output only bookmarks with file paths (exclude e.g. emails)'
|
32
24
|
c.switch %i[f files_only], { negatable: false, default_value: false }
|
@@ -52,7 +44,7 @@ class App
|
|
52
44
|
end
|
53
45
|
|
54
46
|
desc 'Create bidirectional hooks between two or more files/urls'
|
55
|
-
arg_name 'SOURCE [SOURCE
|
47
|
+
arg_name 'SOURCE [SOURCE...] TARGET'
|
56
48
|
command %i[link ln] do |c|
|
57
49
|
c.desc 'Link every listed file or url to every other'
|
58
50
|
c.switch %i[a all], { negatable: false, default_value: false }
|
@@ -79,13 +71,37 @@ class App
|
|
79
71
|
|
80
72
|
desc 'Copy Hook URL for file/url to clipboard'
|
81
73
|
arg_name 'FILE_OR_URL'
|
82
|
-
command %i[clip] do |c|
|
74
|
+
command %i[clip cp] do |c|
|
83
75
|
c.desc 'Copy as Markdown'
|
84
|
-
c.switch %i[m markdown]
|
76
|
+
c.switch %i[m markdown], { negatable: false, default_value: false }
|
77
|
+
|
78
|
+
c.desc 'Copy from application'
|
79
|
+
c.flag %i[a app], { arg_name: 'APP_NAME' }
|
85
80
|
|
86
81
|
c.action do |_global_options, options, args|
|
87
|
-
|
88
|
-
|
82
|
+
raise 'Wrong number of arguments. Requires a path/url or -a APP_NAME' if args.length != 1 && !options[:a]
|
83
|
+
|
84
|
+
if options[:a]
|
85
|
+
puts hooker.bookmark_from_app(options[:a], { copy: true, markdown: options[:m] })
|
86
|
+
else
|
87
|
+
puts hooker.clip_bookmark(args[0], { markdown: options[:m] })
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
desc 'Get a Hook URL for the frontmost window of an app'
|
93
|
+
arg_name 'APPLICATION_NAME'
|
94
|
+
command %i[from] do |c|
|
95
|
+
c.desc 'Output as Markdown'
|
96
|
+
c.switch %i[m markdown], { negatable: false, default_value: false }
|
97
|
+
|
98
|
+
c.desc 'Copy to clipboard'
|
99
|
+
c.switch %i[c copy], { negatable: false, default_value: false }
|
100
|
+
|
101
|
+
c.action do |_global_options, options, args|
|
102
|
+
raise "Wrong number of arguments (1 expected, #{args.length} given)" if args.length != 1
|
103
|
+
|
104
|
+
puts hooker.bookmark_from_app(args[0], { copy: options[:c], markdown: options[:m] })
|
89
105
|
end
|
90
106
|
end
|
91
107
|
|
@@ -103,7 +119,7 @@ class App
|
|
103
119
|
|
104
120
|
desc 'Clone all hooks from one file or url onto another'
|
105
121
|
arg_name 'SOURCE TARGET'
|
106
|
-
command %i[clone
|
122
|
+
command %i[clone] do |c|
|
107
123
|
c.action do |_global_options, _options, args|
|
108
124
|
raise "Wrong number of arguments. Two file paths or urls required (#{args.length} given)" if args.length != 2
|
109
125
|
|
data/hook.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
== hook - CLI interface for Hook.app (macOS)
|
2
2
|
|
3
|
-
v0.0.
|
3
|
+
v0.0.5
|
4
4
|
|
5
5
|
=== Global Options
|
6
6
|
=== --help
|
@@ -14,20 +14,42 @@ Display the program version
|
|
14
14
|
|
15
15
|
|
16
16
|
=== Commands
|
17
|
-
==== Command: <tt>clip FILE_OR_URL</tt>
|
17
|
+
==== Command: <tt>clip|cp FILE_OR_URL</tt>
|
18
18
|
Copy Hook URL for file/url to clipboard
|
19
19
|
|
20
20
|
|
21
21
|
===== Options
|
22
|
-
===== -
|
22
|
+
===== -a|--app APP_NAME
|
23
|
+
|
24
|
+
Copy from application
|
25
|
+
|
26
|
+
[Default Value] None
|
27
|
+
|
28
|
+
|
29
|
+
===== -m|--markdown
|
23
30
|
Copy as Markdown
|
24
31
|
|
25
32
|
|
26
33
|
|
27
|
-
==== Command: <tt>clone
|
34
|
+
==== Command: <tt>clone SOURCE TARGET</tt>
|
28
35
|
Clone all hooks from one file or url onto another
|
29
36
|
|
30
37
|
|
38
|
+
==== Command: <tt>from APPLICATION_NAME</tt>
|
39
|
+
Get a Hook URL for the frontmost window of an app
|
40
|
+
|
41
|
+
|
42
|
+
===== Options
|
43
|
+
===== -c|--copy
|
44
|
+
Copy to clipboard
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
===== -m|--markdown
|
49
|
+
Output as Markdown
|
50
|
+
|
51
|
+
|
52
|
+
|
31
53
|
==== Command: <tt>help command</tt>
|
32
54
|
Shows a list of commands or help for one command
|
33
55
|
|
@@ -38,7 +60,7 @@ List commands one per line, to assist with shell completion
|
|
38
60
|
|
39
61
|
|
40
62
|
|
41
|
-
==== Command: <tt>link|ln SOURCE [SOURCE
|
63
|
+
==== Command: <tt>link|ln SOURCE [SOURCE...] TARGET</tt>
|
42
64
|
Create bidirectional hooks between two or more files/urls
|
43
65
|
|
44
66
|
|
@@ -53,7 +75,7 @@ Paste URL from clipboard
|
|
53
75
|
|
54
76
|
|
55
77
|
|
56
|
-
==== Command: <tt>list|ls FILE_OR_URL [FILE_OR_URL
|
78
|
+
==== Command: <tt>list|ls FILE_OR_URL [FILE_OR_URL...]</tt>
|
57
79
|
List hooks on a file or url
|
58
80
|
|
59
81
|
|
data/hookapp.gemspec
CHANGED
@@ -15,8 +15,8 @@ spec = Gem::Specification.new do |s|
|
|
15
15
|
s.rdoc_options << '--title' << 'hook' << '--main' << 'README.rdoc' << '-ri'
|
16
16
|
s.bindir = 'bin'
|
17
17
|
s.executables << 'hook'
|
18
|
-
s.add_development_dependency('rake')
|
19
|
-
s.add_development_dependency('rdoc')
|
20
|
-
s.add_development_dependency('aruba')
|
18
|
+
s.add_development_dependency('rake','~> 13.0.1')
|
19
|
+
s.add_development_dependency('rdoc','~> 6.1.2')
|
20
|
+
s.add_development_dependency('aruba','~> 0.14.14')
|
21
21
|
s.add_runtime_dependency('gli','2.19.0')
|
22
22
|
end
|
data/lib/hook/hooker.rb
CHANGED
@@ -18,21 +18,37 @@ class String
|
|
18
18
|
def valid_hook
|
19
19
|
if File.exist?(self)
|
20
20
|
File.expand_path(self)
|
21
|
-
elsif self =~
|
22
|
-
|
21
|
+
elsif self =~ /^\[.*?\]\((.*?)\)$/
|
22
|
+
mdlink = $1
|
23
|
+
mdlink.valid_hook
|
23
24
|
else
|
24
|
-
|
25
|
-
mdlink = $1
|
26
|
-
mdlink.valid_hook
|
27
|
-
else
|
28
|
-
false
|
29
|
-
end
|
25
|
+
self
|
30
26
|
end
|
31
27
|
end
|
32
28
|
|
33
29
|
def valid_hook!
|
34
30
|
replace valid_hook
|
35
31
|
end
|
32
|
+
|
33
|
+
# Capitalize only if no uppercase
|
34
|
+
def cap
|
35
|
+
unless self =~ /[A-Z]/
|
36
|
+
capitalize
|
37
|
+
else
|
38
|
+
self
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def cap!
|
43
|
+
replace cap
|
44
|
+
end
|
45
|
+
|
46
|
+
def clip
|
47
|
+
res = `/bin/echo -n #{Shellwords.escape(self)} | pbcopy`.strip
|
48
|
+
raise "Failed to copy to clipboard" unless res.empty?
|
49
|
+
|
50
|
+
true
|
51
|
+
end
|
36
52
|
end
|
37
53
|
|
38
54
|
# Hook.app CLI interface
|
@@ -42,15 +58,16 @@ class Hooker
|
|
42
58
|
end
|
43
59
|
|
44
60
|
def validate_format(fmt, options)
|
45
|
-
valid_format_rx = options.map { |
|
61
|
+
valid_format_rx = options.map { |format| format.sub(/^(.)(.*)$/, '^\1(\2)?$') }
|
46
62
|
valid_format = false
|
47
63
|
valid_format_rx.each_with_index do |rx, i|
|
48
64
|
cmp = Regexp.new(rx, 'i')
|
49
65
|
next unless fmt =~ cmp
|
66
|
+
|
50
67
|
valid_format = options[i]
|
51
68
|
break
|
52
69
|
end
|
53
|
-
|
70
|
+
valid_format
|
54
71
|
end
|
55
72
|
|
56
73
|
def bookmark_for(url)
|
@@ -88,15 +105,39 @@ class Hooker
|
|
88
105
|
hooks.split_hooks
|
89
106
|
end
|
90
107
|
|
91
|
-
def
|
108
|
+
def bookmark_from_app(app, opts)
|
109
|
+
mark = `osascript <<'APPLESCRIPT'
|
110
|
+
tell application "System Events" to set front_app to name of first application process whose frontmost is true
|
111
|
+
tell application "#{app}" to activate
|
112
|
+
delay 2
|
113
|
+
tell application "Hook"
|
114
|
+
set _hook to (bookmark from active window)
|
115
|
+
set _output to (title of _hook & "||" & address of _hook & "||" & path of _hook)
|
116
|
+
end tell
|
117
|
+
tell application front_app to activate
|
118
|
+
return _output
|
119
|
+
APPLESCRIPT`.strip.split_hook
|
120
|
+
title = mark[:name].empty? ? "#{app.cap} link" : mark[:name]
|
121
|
+
output = opts[:markdown] ? "[#{title}](#{mark[:url]})" : mark[:url]
|
122
|
+
|
123
|
+
if opts[:copy]
|
124
|
+
"Copied Markdown link for '#{title}' to clipboard" if output.clip
|
125
|
+
else
|
126
|
+
output
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def clip_bookmark(url, opts)
|
92
131
|
mark = bookmark_for(url)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
132
|
+
copy_bookmark(mark[:name], mark[:url], opts)
|
133
|
+
end
|
134
|
+
|
135
|
+
def copy_bookmark(title, url, opts)
|
136
|
+
raise "No URL found" if url.empty?
|
137
|
+
title = title.empty? ? 'No title' : title
|
138
|
+
output = opts[:markdown] ? "[#{title}](#{url})" : url
|
139
|
+
output.clip
|
140
|
+
%(Copied #{opts[:markdown] ? 'Markdown link' : 'Hook URL'} for '#{title}' to clipboard)
|
100
141
|
end
|
101
142
|
|
102
143
|
def select_hook(marks)
|
@@ -106,12 +147,9 @@ class Hooker
|
|
106
147
|
end
|
107
148
|
STDERR.print 'Open which bookmark: '
|
108
149
|
sel = STDIN.gets.strip.to_i
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
warn 'Invalid selection'
|
113
|
-
Process.exit 1
|
114
|
-
end
|
150
|
+
raise 'Invalid selection' unless sel.positive? && sel <= marks.length
|
151
|
+
|
152
|
+
marks[sel - 1]
|
115
153
|
end
|
116
154
|
|
117
155
|
def open_gui(url)
|
@@ -218,9 +256,9 @@ class Hooker
|
|
218
256
|
return true
|
219
257
|
end tell
|
220
258
|
APPLESCRIPT`
|
221
|
-
|
259
|
+
"Hook removed between #{source} and #{target}"
|
222
260
|
else
|
223
|
-
raise
|
261
|
+
raise 'Invalid number of URLs or files specified'
|
224
262
|
|
225
263
|
end
|
226
264
|
end
|
@@ -228,9 +266,7 @@ class Hooker
|
|
228
266
|
def link_all(args)
|
229
267
|
args.each do |file|
|
230
268
|
source = file.valid_hook
|
231
|
-
link_to = args.dup.map(&:
|
232
|
-
url == source
|
233
|
-
}
|
269
|
+
link_to = args.dup.map(&:valid_hook).reject { |url| url == source }
|
234
270
|
link_to.each do |url|
|
235
271
|
`osascript <<'APPLESCRIPT'
|
236
272
|
tell application "Hook"
|
data/lib/hook/version.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hookapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 13.0.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 13.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 6.1.2
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 6.1.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: aruba
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.14.14
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.14.14
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: gli
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.19.0
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email: me@brettterpstra.com
|
71
71
|
executables:
|
72
72
|
- hook
|
@@ -76,6 +76,7 @@ extra_rdoc_files:
|
|
76
76
|
- hook.rdoc
|
77
77
|
files:
|
78
78
|
- ".gitignore"
|
79
|
+
- CHANGELOG.md
|
79
80
|
- Gemfile
|
80
81
|
- Gemfile.lock
|
81
82
|
- README.md
|
@@ -107,7 +108,7 @@ files:
|
|
107
108
|
homepage: https://brettterpstra.com
|
108
109
|
licenses: []
|
109
110
|
metadata: {}
|
110
|
-
post_install_message:
|
111
|
+
post_install_message:
|
111
112
|
rdoc_options:
|
112
113
|
- "--title"
|
113
114
|
- hook
|
@@ -128,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
129
|
- !ruby/object:Gem::Version
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
|
-
rubygems_version: 3.0.
|
132
|
-
signing_key:
|
132
|
+
rubygems_version: 3.0.6
|
133
|
+
signing_key:
|
133
134
|
specification_version: 4
|
134
135
|
summary: A CLI for Hook.app (macOS)
|
135
136
|
test_files: []
|