sheldon 6.1.1 → 6.2.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/bin/sheldon +18 -7
- data/lib/sheldon/brain.rb +4 -3
- data/lib/sheldon/sheldon.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae77eea72d0cbd8122af494ca74a65b695239441e9404ec638264d177c3402e4
|
4
|
+
data.tar.gz: d75771ef4eeefc50b7d7797d3a7e0acc9bade0b1e82d0f4c7b05868414339c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a23ca4c9ad09b76eeaba8b08bc080867dce4525a5ac6257efeb9455252686cbba41bdf6429110b25053ecb0c0c319f73e8c7c36be4969ce1498ea9c1172a446
|
7
|
+
data.tar.gz: 1292f1dc3fd7929d64c216381204d3faaf73cc230246f944fe5e2b7c9ba45452b08630645b84aa4af781bfccd743210ffc10df390a84dd4578fd294a904d315f
|
data/bin/sheldon
CHANGED
@@ -66,12 +66,12 @@ module CLI
|
|
66
66
|
|
67
67
|
if options[:i]
|
68
68
|
cue_options.each do |recall_cue|
|
69
|
-
|
70
|
-
|
69
|
+
recall_confirmed = prompt.yes?("Recall #{recall_cue}?")
|
70
|
+
perform_recall(recall_cue) if recall_confirmed
|
71
71
|
end
|
72
72
|
else
|
73
73
|
recall_cue ||= cue_picker("What would you like to recall?", cue_options)
|
74
|
-
|
74
|
+
perform_recall(recall_cue)
|
75
75
|
prompt.ok("Sheldon recall complete: #{recall_cue}")
|
76
76
|
end
|
77
77
|
end
|
@@ -101,17 +101,28 @@ module CLI
|
|
101
101
|
|
102
102
|
private
|
103
103
|
|
104
|
+
def cue_picker(message, options=sheldon.list_cues)
|
105
|
+
prompt.select(message, options, per_page: 20, filter: true)
|
106
|
+
end
|
107
|
+
|
104
108
|
def error_and_exit(message)
|
105
109
|
prompt.error(message)
|
106
110
|
exit!
|
107
111
|
end
|
108
112
|
|
109
|
-
def
|
110
|
-
|
113
|
+
def perform_recall(recall_cue)
|
114
|
+
with_exception_handling do
|
115
|
+
begin
|
116
|
+
sheldon.recall(recall_cue)
|
117
|
+
rescue DestinationNotEmptyException => e
|
118
|
+
overwrite_confirmed = prompt.yes?("File/target already exists. Overwrite?")
|
119
|
+
sheldon.recall(recall_cue, overwrite: true) if overwrite_confirmed
|
120
|
+
end
|
121
|
+
end
|
111
122
|
end
|
112
123
|
|
113
|
-
def
|
114
|
-
prompt.
|
124
|
+
def prompt
|
125
|
+
@prompt ||= TTY::Prompt.new(interrupt: :exit)
|
115
126
|
end
|
116
127
|
|
117
128
|
def read_from_dotfile(key)
|
data/lib/sheldon/brain.rb
CHANGED
@@ -47,15 +47,16 @@ class Brain
|
|
47
47
|
memory.present?
|
48
48
|
end
|
49
49
|
|
50
|
-
def recall(recall_cue)
|
50
|
+
def recall(recall_cue, opts={})
|
51
51
|
entry = memory.recall(recall_cue)
|
52
52
|
destination_path = add_home(entry[:filepath])
|
53
53
|
destination_dir = File.dirname(destination_path)
|
54
|
-
|
54
|
+
|
55
|
+
raise DestinationNotEmptyException, "#{destination_path} already exists." if File.exist?(destination_path) && !opts[:overwrite]
|
55
56
|
|
56
57
|
FileUtils.mkdir_p(destination_dir) unless File.directory?(destination_dir)
|
57
58
|
brain_path = brain_directory_for_cue(recall_cue)
|
58
|
-
FileUtils.ln_s(get_content(brain_path), destination_path)
|
59
|
+
FileUtils.ln_s(get_content(brain_path), destination_path, force: opts[:overwrite])
|
59
60
|
return true
|
60
61
|
end
|
61
62
|
|
data/lib/sheldon/sheldon.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
|
3
3
|
class Sheldon
|
4
|
-
VERSION = "6.
|
4
|
+
VERSION = "6.2.0".freeze
|
5
5
|
attr_reader :brain, :builder
|
6
6
|
|
7
7
|
def initialize(sheldon_data_dir)
|
@@ -29,8 +29,8 @@ class Sheldon
|
|
29
29
|
brain.list_cues
|
30
30
|
end
|
31
31
|
|
32
|
-
def recall(recall_cue)
|
33
|
-
brain.recall(recall_cue)
|
32
|
+
def recall(recall_cue, opts={})
|
33
|
+
brain.recall(recall_cue, opts)
|
34
34
|
end
|
35
35
|
|
36
36
|
def setup!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sheldon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|