work_guide 1.1.1 → 1.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/lib/work_guide/cli.rb +18 -14
- data/lib/work_guide/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: 3601b0cf778beaeb88809a78d26dd3e338550816
|
4
|
+
data.tar.gz: 6febc2436d8db93a8d50e15fc24194941fedcc3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e52c8c74631eed4eb219c3cbaf9b7cf57e1018b30eddc68d6b03d1a60256c2fb6f9287fed127e7a707d556c1ff05b538fa0c21a0705beb99de42a4b6836a9493
|
7
|
+
data.tar.gz: 1939f4abf82766b61bcb5203af79e1c9517fce46f6b08a5263dda29bc11c008219cccbaed9010c8a95eef40cf6ca5f34997d20d88f2aa63500154770e015a530
|
data/lib/work_guide/cli.rb
CHANGED
@@ -17,7 +17,8 @@ module WorkGuide
|
|
17
17
|
|
18
18
|
desc "update [index]", "Edit a guide"
|
19
19
|
option :priority, default: 'medium', banner: '[high|medium|low]'
|
20
|
-
def update(index)
|
20
|
+
def update(index = nil)
|
21
|
+
index = boot_peco(all: true) unless index.present?
|
21
22
|
guide = Guide.all[index.to_i]
|
22
23
|
guide.priority = options[:priority] if options[:priority]
|
23
24
|
Guide.save
|
@@ -32,7 +33,8 @@ module WorkGuide
|
|
32
33
|
default_task :list
|
33
34
|
|
34
35
|
desc "delete [index]", "Delete a guide"
|
35
|
-
def delete(index)
|
36
|
+
def delete(index = nil)
|
37
|
+
index = boot_peco(all: true) unless index.present?
|
36
38
|
guide = Guide.all.delete_at(index.to_i)
|
37
39
|
Guide.save
|
38
40
|
puts "Deleted [#{index}]#{guide}"
|
@@ -42,18 +44,7 @@ module WorkGuide
|
|
42
44
|
option :at, banner: "done_at"
|
43
45
|
def done(*args)
|
44
46
|
indexes = args.dup
|
45
|
-
if indexes.empty?
|
46
|
-
IO.popen("peco", "r+") do |io|
|
47
|
-
io.puts guide_table
|
48
|
-
io.close_write
|
49
|
-
index = io.gets.split("|")[1]
|
50
|
-
if index && index =~ /\d/
|
51
|
-
indexes << index.strip
|
52
|
-
else
|
53
|
-
abort "[ERROR] Please select guide index !!"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
47
|
+
indexes << boot_peco if indexes.empty?
|
57
48
|
|
58
49
|
guides = indexes.map { |index| Guide.all[index.to_i] }
|
59
50
|
done_at =
|
@@ -75,6 +66,19 @@ module WorkGuide
|
|
75
66
|
|
76
67
|
private
|
77
68
|
|
69
|
+
def boot_peco(all: false)
|
70
|
+
IO.popen("peco", "r+") do |io|
|
71
|
+
io.puts guide_table(all: all)
|
72
|
+
io.close_write
|
73
|
+
index = io.gets.split("|")[1]
|
74
|
+
if index && index =~ /\d/
|
75
|
+
index.strip
|
76
|
+
else
|
77
|
+
abort "[ERROR] Please select guide index !!"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
78
82
|
def guide_table(all: false)
|
79
83
|
rows = Guide.all.map.with_index { |guide, index|
|
80
84
|
[index, guide]
|
data/lib/work_guide/version.rb
CHANGED