peter-notes 0.1.3 → 0.1.4
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/models/console_app.rb +10 -4
- data/lib/models/notes.rb +2 -0
- data/lib/peter_notes/version.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: 36ed6b27ee088d9e82978d61feb073b23e89686b
|
|
4
|
+
data.tar.gz: 378deab42cb4839d42df552e456bdabec06ee236
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c435fa8dd39d20200c1af85a52675e2ce42241adf65a0a06ca548cc8c6cf8495f79e0d9ea0a946bbe697abd82a5f3784f4649bb438da7c96f97d4a580892bde4
|
|
7
|
+
data.tar.gz: c64c96d435443e296271b396a9631febd5e80a6d46621af8534ab03a7f1ce227b13ac8a54bbd1be1d386537342469237b76aa1edfe6fb3ea90de67900b4ff26b
|
data/lib/models/console_app.rb
CHANGED
|
@@ -3,8 +3,8 @@ require 'models/preferences'
|
|
|
3
3
|
|
|
4
4
|
class ConsoleApp
|
|
5
5
|
def run
|
|
6
|
-
arg = ARGV[0]
|
|
7
|
-
OptionParser.new do |opts|
|
|
6
|
+
arg = ARGV[0]
|
|
7
|
+
options = OptionParser.new do |opts|
|
|
8
8
|
opts.banner = 'Usage: notes [options]'
|
|
9
9
|
opts.separator('')
|
|
10
10
|
opts.separator('Options:')
|
|
@@ -18,7 +18,7 @@ class ConsoleApp
|
|
|
18
18
|
exit(0)
|
|
19
19
|
end
|
|
20
20
|
opts.on('-l', '--list [PATH]', 'List all notes', ' (list notes under PATH if supplied)') do |path|
|
|
21
|
-
|
|
21
|
+
self.list(path)
|
|
22
22
|
exit(0)
|
|
23
23
|
end
|
|
24
24
|
opts.on('-h', '--help', 'Show this message') do
|
|
@@ -35,7 +35,13 @@ class ConsoleApp
|
|
|
35
35
|
|
|
36
36
|
opts.separator('')
|
|
37
37
|
opts.separator("Documentation at https://github.com/fonsecapeter/peter-notes or man peter-notes")
|
|
38
|
-
end
|
|
38
|
+
end
|
|
39
|
+
begin
|
|
40
|
+
options.parse!
|
|
41
|
+
rescue OptionParser::InvalidOption
|
|
42
|
+
puts(options)
|
|
43
|
+
exit(1)
|
|
44
|
+
end
|
|
39
45
|
self.on_run(arg)
|
|
40
46
|
end
|
|
41
47
|
end
|
data/lib/models/notes.rb
CHANGED
|
@@ -15,6 +15,7 @@ class Notes < ConsoleApp
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def find(glob)
|
|
18
|
+
return [] if glob.nil? || glob.empty?
|
|
18
19
|
glob_path, glob_terminus = File.split(glob)
|
|
19
20
|
glob_path.gsub!(File::SEPARATOR, '.*')
|
|
20
21
|
cmd = "find \"#{@notes_dir}\" -name \"#{glob_terminus}\""
|
|
@@ -36,6 +37,7 @@ class Notes < ConsoleApp
|
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
def list(path)
|
|
40
|
+
path = path || ''
|
|
39
41
|
notes_path = File.join(@notes_dir, path)
|
|
40
42
|
system("tree #{notes_path}")
|
|
41
43
|
end
|
data/lib/peter_notes/version.rb
CHANGED