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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51a33aad3cbed45ed09f6fa35f2046223dca0d5dd82fe15be7c49cb8aaa4c41d
4
- data.tar.gz: 3054f0c7657e98c6c794b768ca9450992d3ee83b91526fc9cb88c5de6a4bc5ad
3
+ metadata.gz: 13dc462a7bedf194daa250fdd6fc0b7bdcc61374873c23fb3a03e48e73c5e287
4
+ data.tar.gz: bffeeb80575559e1404dd81543ab5b36a87fe74cb8e3c908495c5afb0196f0cd
5
5
  SHA512:
6
- metadata.gz: e6ced499e2b20d75987fc8c538b95bfb5a9912549b49848c0b6e827bc3c5f8dd3aed72c17c585b5080d16c60a48832d57f6a829d5ebf465f9068969418dc4898
7
- data.tar.gz: fb1a648048fbe579ae1cdaee106da02fc1dc345874119fa0ef846dbc1d0631e63dbec150c5509b66a325ecce991969acf369ce5b096b9571d4c97269294bb66a
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
- def initialize
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
- warn "Warning: ".yel +
113
- "YAML configuration file couldn't be found. Using defaults."
114
- warn "Suggest: ".grn + "booker --install config"
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
@@ -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
- Config.default.write(:bookmarks, bms)
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
- Config.default.write(:bookmarks, selected)
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
- Config.default.write
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. --no-sort keeps booker's ordering.
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
- "--no-sort",
31
+ "--tiebreak=index",
29
32
  "--delimiter=\t",
30
33
  "--with-nth=2..",
31
34
  "--prompt=bookmark> "
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Booker
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
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.0.0
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.18
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: []