todo_cli_app 0.2.0 → 0.3.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/context.rb +4 -0
- data/lib/parser.rb +6 -1
- data/lib/session.rb +8 -1
- data/lib/version.rb +1 -1
- data/lib/visualizer.rb +6 -0
- 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: c1c83918a499fec38e8dd67bc720beef4db1617735123dd42461a14752ef82fa
|
4
|
+
data.tar.gz: e188b50840d954bf8f73fb56b47ba168169ce4391f9cb7095a06a3dc95517e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20c39dca88b36af7f9a55b669845687cd39cc923d1db358bdd1350fcd28334193a68b6fed8b1b8f757357913f40705d9b56a1941bdba5b6b8d7788b3f0f18d2b
|
7
|
+
data.tar.gz: ee1bf6cd45ae023127e6625ba0164745c49e638c8158d6a115c4653b9dee00c8932245aff759acec08fd249e1aa1417772f1714f6dffcbbd0191dacf89466225
|
data/lib/context.rb
CHANGED
data/lib/parser.rb
CHANGED
@@ -5,7 +5,7 @@ module ToDo
|
|
5
5
|
# OptionParser wrapper for the to-do app.
|
6
6
|
#
|
7
7
|
class Parser
|
8
|
-
Options = Struct.new(:date, :yesterday, :tomorrow, :query, :visualize, keyword_init: true)
|
8
|
+
Options = Struct.new(:date, :editor, :yesterday, :tomorrow, :query, :visualize, keyword_init: true)
|
9
9
|
|
10
10
|
attr_reader :args
|
11
11
|
|
@@ -19,6 +19,7 @@ module ToDo
|
|
19
19
|
A ruby CLI-only To Do app, because why not?
|
20
20
|
Usage:
|
21
21
|
todo -d, --date 2020-12-25 # Open todo for the date
|
22
|
+
todo -e, --editor code # Uses code as the editor. Default is $EDITOR.
|
22
23
|
todo -y, --yesterday # Open todo yesterday
|
23
24
|
todo -t, --tomorrow # Open todo for tomorrow
|
24
25
|
todo # Open todo for today
|
@@ -41,6 +42,10 @@ module ToDo
|
|
41
42
|
options.date = parse_date(d)
|
42
43
|
end
|
43
44
|
|
45
|
+
parser.on('-eEDITOR', '--editor=EDITOR', 'Editor command') do |e|
|
46
|
+
options.editor = e
|
47
|
+
end
|
48
|
+
|
44
49
|
parser.on('-fQUERY', '--find=QUERY', 'Looks for query') do |q|
|
45
50
|
options.query = q
|
46
51
|
end
|
data/lib/session.rb
CHANGED
@@ -28,11 +28,18 @@ module ToDo
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def start
|
31
|
-
system("
|
31
|
+
exit_and_set_editor unless system("command -v #{context.editor}", out: ['/dev/null'])
|
32
|
+
system("#{context.editor} #{context.file_path}")
|
32
33
|
end
|
33
34
|
|
34
35
|
private
|
35
36
|
|
37
|
+
def exit_and_set_editor
|
38
|
+
puts "#{context.editor} not found" if context.editor
|
39
|
+
puts "Please set an editor to use with `todo -e EDITOR'. Check `todo -h' for more info."
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
|
36
43
|
def prepare_todo_file
|
37
44
|
return if Dir[context.file_path].any?
|
38
45
|
|
data/lib/version.rb
CHANGED
data/lib/visualizer.rb
CHANGED
@@ -19,6 +19,7 @@ module ToDo
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def view
|
22
|
+
exit_and_install_pandoc unless system('command -v pandoc', out: ['/dev/null'])
|
22
23
|
raise 'Something failed with Pandoc' unless system(command)
|
23
24
|
|
24
25
|
update_body_class
|
@@ -38,6 +39,11 @@ module ToDo
|
|
38
39
|
].join(' ')
|
39
40
|
end
|
40
41
|
|
42
|
+
def exit_and_install_pandoc
|
43
|
+
puts 'Please install pandoc first. https://pandoc.org/installing.html'
|
44
|
+
exit 1
|
45
|
+
end
|
46
|
+
|
41
47
|
def tmpfile
|
42
48
|
"#{File.join(Dir.tmpdir, context.file_name)}.html"
|
43
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: todo_cli_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Manuel Ramallo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A to-do app, the ruby cli-only edition to-do app [insert registered mark
|
14
14
|
logo here].
|