booker 2.0.0 → 2.1.0
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/lib/booker/config.rb +10 -4
- data/lib/booker/installer.rb +10 -3
- data/lib/booker/picker.rb +5 -2
- data/lib/booker/version.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13dc462a7bedf194daa250fdd6fc0b7bdcc61374873c23fb3a03e48e73c5e287
|
|
4
|
+
data.tar.gz: bffeeb80575559e1404dd81543ab5b36a87fe74cb8e3c908495c5afb0196f0cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11fc60dbe348abd38052010e3073f7ad524bc81b0aeb1017741f25a1a8b3108654443c91444c40d07d065907f9b59117768ab5f2e9923b3fbd529f335c5082c7
|
|
7
|
+
data.tar.gz: 130643b4c4920f03d273cdfde85955295ca6fd701031fffe6228aad52e26e8b5e7f11c784d6ad5f914371785ad321074e155fff2a5eab657030bb45a60671d9c
|
data/lib/booker/config.rb
CHANGED
|
@@ -71,7 +71,11 @@ module Booker
|
|
|
71
71
|
def reset! = @default = nil
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
# quiet_missing is for --install, which is about to write the very file the
|
|
75
|
+
# warning would tell the user to go and create
|
|
76
|
+
def initialize(quiet_missing: false)
|
|
77
|
+
@quiet_missing = quiet_missing
|
|
78
|
+
|
|
75
79
|
# the yaml file if there is one, and only work out the defaults when
|
|
76
80
|
# there is not: discovery walks every chrome profile directory to answer
|
|
77
81
|
# a question the config file has already answered
|
|
@@ -109,9 +113,11 @@ module Booker
|
|
|
109
113
|
# #write emits symbol keys, so they have to be permitted on the way back
|
|
110
114
|
YAML.safe_load_file(file, permitted_classes: [Symbol])
|
|
111
115
|
rescue Errno::ENOENT
|
|
112
|
-
|
|
113
|
-
"
|
|
114
|
-
|
|
116
|
+
unless @quiet_missing
|
|
117
|
+
warn "Warning: ".yel +
|
|
118
|
+
"YAML configuration file couldn't be found. Using defaults."
|
|
119
|
+
warn "Suggest: ".grn + "booker --install config"
|
|
120
|
+
end
|
|
115
121
|
false
|
|
116
122
|
rescue Psych::Exception
|
|
117
123
|
# every psych failure means the same thing here - an unusable config to
|
data/lib/booker/installer.rb
CHANGED
|
@@ -242,6 +242,13 @@ module Booker
|
|
|
242
242
|
yield if block_given?
|
|
243
243
|
end
|
|
244
244
|
|
|
245
|
+
# every target that touches the config is about to write it, so the
|
|
246
|
+
# missing-file warning would only tell the user to do what they are doing.
|
|
247
|
+
# its own instance rather than Config.default: that memo is shared with the
|
|
248
|
+
# rest of the run, and whichever caller built it first would decide whether
|
|
249
|
+
# the warning shows for everyone
|
|
250
|
+
def config = @config ||= Config.new(quiet_missing: true)
|
|
251
|
+
|
|
245
252
|
def home
|
|
246
253
|
ENV["HOME"] || "/usr/local"
|
|
247
254
|
end
|
|
@@ -288,7 +295,7 @@ module Booker
|
|
|
288
295
|
if selection == 0
|
|
289
296
|
# User selected "ALL" - save array of all paths
|
|
290
297
|
puts "Selected: ".yel + "All sources (#{bms.length} bookmark files)"
|
|
291
|
-
|
|
298
|
+
config.write(:bookmarks, bms)
|
|
292
299
|
puts "Success: ".grn + "config file updated to search all bookmark sources"
|
|
293
300
|
else
|
|
294
301
|
save_bookmarks(bms[selection - 1], "config file updated with your bookmarks")
|
|
@@ -302,7 +309,7 @@ module Booker
|
|
|
302
309
|
|
|
303
310
|
def save_bookmarks(selected, message)
|
|
304
311
|
puts "Selected: ".yel + selected
|
|
305
|
-
|
|
312
|
+
config.write(:bookmarks, selected)
|
|
306
313
|
puts "Success: ".grn + message
|
|
307
314
|
end
|
|
308
315
|
|
|
@@ -316,7 +323,7 @@ module Booker
|
|
|
316
323
|
end
|
|
317
324
|
|
|
318
325
|
def install_config
|
|
319
|
-
|
|
326
|
+
config.write
|
|
320
327
|
puts "Success: ".grn + "example config file written to ~/.booker"
|
|
321
328
|
rescue
|
|
322
329
|
pexit "Failure: ".red + "could not write example config file to ~/.booker"
|
data/lib/booker/picker.rb
CHANGED
|
@@ -12,7 +12,10 @@ module Booker
|
|
|
12
12
|
module Picker
|
|
13
13
|
# --delimiter/--with-nth hide the id column: it is noise on screen, and
|
|
14
14
|
# hiding it also takes it out of the match, so typing "2_" does not pull up
|
|
15
|
-
# every bookmark from the second source.
|
|
15
|
+
# every bookmark from the second source. fzf ranks by match score, so a
|
|
16
|
+
# literal "sofa" beats s..o..f..a scattered across a long url, and
|
|
17
|
+
# --tiebreak=index keeps booker's ordering among equal scores (and for the
|
|
18
|
+
# empty query, which fzf never sorts).
|
|
16
19
|
#
|
|
17
20
|
# deliberately no --multi: under it fzf reads tab as "mark this and move
|
|
18
21
|
# down" - the one key booker's own completion trained everybody to press -
|
|
@@ -25,7 +28,7 @@ module Booker
|
|
|
25
28
|
"fzf",
|
|
26
29
|
"--height=40%",
|
|
27
30
|
"--reverse",
|
|
28
|
-
"--
|
|
31
|
+
"--tiebreak=index",
|
|
29
32
|
"--delimiter=\t",
|
|
30
33
|
"--with-nth=2..",
|
|
31
34
|
"--prompt=bookmark> "
|
data/lib/booker/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: booker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Warner
|
|
@@ -13,16 +13,22 @@ dependencies:
|
|
|
13
13
|
name: json
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
18
|
version: '2.21'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '4.0'
|
|
19
22
|
type: :runtime
|
|
20
23
|
prerelease: false
|
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
25
|
requirements:
|
|
23
|
-
- - "
|
|
26
|
+
- - ">="
|
|
24
27
|
- !ruby/object:Gem::Version
|
|
25
28
|
version: '2.21'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '4.0'
|
|
26
32
|
- !ruby/object:Gem::Dependency
|
|
27
33
|
name: sqlite3
|
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -105,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
105
111
|
- !ruby/object:Gem::Version
|
|
106
112
|
version: '0'
|
|
107
113
|
requirements: []
|
|
108
|
-
rubygems_version: 4.0.
|
|
114
|
+
rubygems_version: 4.0.23
|
|
109
115
|
specification_version: 4
|
|
110
116
|
summary: CLI bookmark manager for Chrome, Firefox, and Safari
|
|
111
117
|
test_files: []
|