sheldon 0.5.4 → 0.5.5
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 +9 -23
- data/lib/sheldon/sheldon.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3849dcc28716d5aafca1ee0dafda7347d12ae85
|
4
|
+
data.tar.gz: e6a90dc5d6027d5f4e7114aecae52d5b14db2995
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc98eca6fdbb01a0c384aa029620c0286764f36f3d3599ac3dcd9751b07b81eb9548ec108e3421adda50da998949af08942d15adb3ccd91d93a774a9f8d52577
|
7
|
+
data.tar.gz: 58a7b7b0dddead7f6363b513198026bc7501d4f980c1d71ad38d5ac0d333aa9ccefbd8c78d55cad428239cb8efeaf07575b94c7aa25c5cbc166ce122ae9e06c4
|
data/bin/sheldon
CHANGED
@@ -25,7 +25,7 @@ module CLI
|
|
25
25
|
|
26
26
|
desc "forget recall_cue", "Remove file/folder from Sheldon's brain"
|
27
27
|
def forget(recall_cue=nil)
|
28
|
-
recall_cue ||=
|
28
|
+
recall_cue ||= ask("Recall Cue For File/Folder")
|
29
29
|
with_exception_handling { sheldon.forget(recall_cue) }
|
30
30
|
announce("I've forgotten about #{recall_cue}. Let us never mention it again.")
|
31
31
|
end
|
@@ -34,7 +34,7 @@ module CLI
|
|
34
34
|
def learn(rel_path_to_target)
|
35
35
|
abs_learn_path = File.expand_path(rel_path_to_target)
|
36
36
|
default_cue = File.basename(rel_path_to_target)
|
37
|
-
recall_cue =
|
37
|
+
recall_cue = ask("Recall Cue For File/Folder", default: default_cue)
|
38
38
|
with_exception_handling { sheldon.learn(recall_cue, abs_learn_path) }
|
39
39
|
with_exception_handling { sheldon.recall(recall_cue) }
|
40
40
|
end
|
@@ -42,7 +42,7 @@ module CLI
|
|
42
42
|
desc "list", "List all recall cues known by Sheldon"
|
43
43
|
def list
|
44
44
|
sheldon.list_cues.each do |recall_cue|
|
45
|
-
sheldon.recalled?(recall_cue) ?
|
45
|
+
sheldon.recalled?(recall_cue) ? say(recall_cue, :green) : say(recall_cue, :red)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -52,11 +52,11 @@ module CLI
|
|
52
52
|
def recall(recall_cue=nil)
|
53
53
|
if options[:i]
|
54
54
|
sheldon.list_cues.each do |recall_cue|
|
55
|
-
answer =
|
55
|
+
answer = ask("Recall #{recall_cue}? (Y/N)")
|
56
56
|
with_exception_handling { sheldon.recall(recall_cue) if answer.downcase == "y" }
|
57
57
|
end
|
58
58
|
else
|
59
|
-
recall_cue ||=
|
59
|
+
recall_cue ||= ask("Recall Cue For File/Folder")
|
60
60
|
with_exception_handling { sheldon.recall(recall_cue) }
|
61
61
|
end
|
62
62
|
|
@@ -65,16 +65,16 @@ module CLI
|
|
65
65
|
|
66
66
|
desc "setup path_to_data_directory", "Setup Sheldon on this host, supplying the path that where Sheldon's data directory can be found, or should be created."
|
67
67
|
def setup(rel_data_path=nil)
|
68
|
-
rel_data_path ||=
|
68
|
+
rel_data_path ||= ask("Please supply location for new/existing data directory")
|
69
69
|
abs_data_path = File.expand_path(rel_data_path)
|
70
70
|
with_exception_handling do
|
71
71
|
sheldon = ::Sheldon.new(abs_data_path)
|
72
72
|
|
73
73
|
if sheldon.brain.present?
|
74
|
-
|
74
|
+
say("Using existing Sheldon database found at #{abs_data_path}.", :green)
|
75
75
|
else
|
76
76
|
sheldon.setup!
|
77
|
-
|
77
|
+
say("New Sheldon database created at #{abs_data_path}", :green)
|
78
78
|
end
|
79
79
|
|
80
80
|
write_to_dotfile("data_directory", sheldon.brain.location)
|
@@ -93,25 +93,11 @@ module CLI
|
|
93
93
|
puts logo + " Sheldon" + logo + " #{message}"
|
94
94
|
end
|
95
95
|
|
96
|
-
def green(message)
|
97
|
-
puts "\e[32m#{message}\e[0m"
|
98
|
-
end
|
99
|
-
|
100
|
-
def prompt_user(prompt)
|
101
|
-
print(prompt + ": ")
|
102
|
-
input = STDIN.gets.chomp.strip
|
103
|
-
input.empty? ? nil : input
|
104
|
-
end
|
105
|
-
|
106
96
|
def read_from_dotfile(key)
|
107
97
|
dotfile = YAML::Store.new(add_home(".sheldon"))
|
108
98
|
dotfile.transaction { dotfile[key] }
|
109
99
|
end
|
110
100
|
|
111
|
-
def red(message)
|
112
|
-
puts "\e[31m#{message}\e[0m"
|
113
|
-
end
|
114
|
-
|
115
101
|
def sheldon
|
116
102
|
with_exception_handling { @sheldon ||= ::Sheldon.new(sheldon_data_dir) }
|
117
103
|
end
|
@@ -127,7 +113,7 @@ module CLI
|
|
127
113
|
if options[:debug]
|
128
114
|
puts ([e.inspect] + e.backtrace).join("\n")
|
129
115
|
else
|
130
|
-
|
116
|
+
say(e.message + "\nUse --debug to print backtrace", :red)
|
131
117
|
end
|
132
118
|
exit!
|
133
119
|
end
|
data/lib/sheldon/sheldon.rb
CHANGED