never_do 0.1.1 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb4b077e59b83d0023a6b87f0480fcc61a11901e
4
- data.tar.gz: 2d3f2a500e61bd13e095f27a8a6298e4a229cd41
3
+ metadata.gz: a1f81c7c0dbb139b1d6cb36b887b7581eb983e80
4
+ data.tar.gz: 4b68fc0243a160e85751e4812380a801651d5cd2
5
5
  SHA512:
6
- metadata.gz: 3a74c138d16d9726cd582b84a22eec0e6b3e25d7343a2a3e184ba16c229ecf7cd9d330ff2cd628611eb0af414c0526ebeca9034e3a8cecc4baf1ed3ad3196126
7
- data.tar.gz: 84ba33b67481cc33fec4dadfc910fb4b51b5f8e43b20ab4505e1692c47008ae398e7dbae16ca5f14e15603f3126f527a56ccf8d67864d4c8efeada3028e14cf3
6
+ metadata.gz: 20e87b98f70bc34ec953e1da32dad5c368c81583d5b39ff539df09bf4a7185c6b31a6ee02e7178799fcd5bdf8a063945aa80426383feaf048e098f7631cece2d
7
+ data.tar.gz: 4810248d69f3175af92f0eaf5c3cc5cad473ec535f419c91e88ddff6fb2f7af1a549709334486310f4f4ee3542341c66ecedb34472a0a7e37817e7c197fb0e61
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  *.gem
2
+ *.swp
2
3
  /.bundle/
3
4
  /.yardoc
4
5
  /Gemfile.lock
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --color
2
- --require spec_helper
1
+ --color
2
+ --require spec_helper
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -47,6 +47,8 @@ Everything after `x` starting with `a` is considered as add a task, thus
47
47
  `x a ...` is the same as `x add ...`, the same for `l[ist]`, `f[inish]`,
48
48
  `e[dit]`, `g[enerate]`, `h[elp]`.
49
49
 
50
+ ![usage](./screenshots/usage.png)
51
+
50
52
  ## Contribute
51
53
 
52
54
  If you find any bug, or have any question, please file an issue or make a pr,
data/bin/x CHANGED
@@ -4,7 +4,7 @@ require "date"
4
4
  require "fileutils"
5
5
 
6
6
  PATH = "#{ENV["HOME"]}/.never_do"
7
- EDITOR = ENV["EDITOR"] || "gvim"
7
+ EDITOR = ENV["EDITOR"] || "vi"
8
8
 
9
9
  class Task
10
10
  DELIM = "`"
@@ -15,6 +15,9 @@ class Task
15
15
  @desc = desc
16
16
  @start = start == -1 ? _now : start
17
17
  @finish = finish
18
+
19
+ @start = @start.to_i
20
+ @finish = @finish.to_i
18
21
  end
19
22
 
20
23
  def finish!
@@ -23,11 +26,15 @@ class Task
23
26
  end
24
27
 
25
28
  def finish?
26
- @finish.to_i != -1
29
+ @finish != -1
27
30
  end
28
31
 
29
32
  def to_s
30
- [@desc, @start, @finish].join(DELIM)
33
+ [@desc, @start.to_s, @finish.to_s].join(DELIM)
34
+ end
35
+
36
+ def pp
37
+ "#{@desc} [#{_time @start} -> #{_time(@finish)}]"
31
38
  end
32
39
 
33
40
  class << self
@@ -42,6 +49,10 @@ class Task
42
49
  def _now
43
50
  Time.now.to_i
44
51
  end
52
+
53
+ def _time(t)
54
+ t == -1 ? "infinity" : Time.at(t).localtime.strftime("%y/%m/%d %H:%M")
55
+ end
45
56
  end
46
57
 
47
58
  class X
@@ -57,8 +68,9 @@ class X
57
68
  end
58
69
 
59
70
  def list(done=false)
60
- len = @ys.size.to_s.length
61
- @ys.map.with_index { |t, i| "#{i.to_s.ljust(len)} #{t.desc}" }
71
+ ls = done ? @zs : @ys
72
+ len = ls.size.to_s.length
73
+ ls.map.with_index { |t, i| "#{i.to_s.ljust(len)} -- #{t.pp}" }
62
74
  end
63
75
 
64
76
  # after finishing one task, the id is renumbered
@@ -95,7 +107,7 @@ class X
95
107
 
96
108
  m_tasks.sort_by(&:start).each do |task|
97
109
  mark = task.finish? ? "x" : " "
98
- done += 1 if task.finish?
110
+ m_done += 1 if task.finish?
99
111
  f.puts "- [#{mark}] #{task.desc}"
100
112
  end
101
113
 
@@ -136,12 +148,12 @@ def help
136
148
  puts <<-EOH.gsub(/^\s*\|/, "")
137
149
  |Usage: x [OPTION] [ID|TASK|FILE]
138
150
  |
139
- | a TASK add a task
140
- | l list all tasks
141
- | f ID finish task with ID
142
- | e [yz] edit todo file y or done file z
143
- | g [OUTFILE] generate task log to PATH
144
- | h see me
151
+ | add TASK add a task
152
+ | list list all tasks
153
+ | finish ID finish task with ID
154
+ | edit [yz] edit todo file "y" or done file "z"
155
+ | generate [OUTFILE] generate task log to PATH
156
+ | help see me
145
157
  EOH
146
158
  end
147
159
 
@@ -152,7 +164,7 @@ def never_do
152
164
  when /^a.*/
153
165
  x.add(ARGV.join(" "))
154
166
  when /^l.*/, nil
155
- x.list.each { |t| puts t }
167
+ x.list(!ARGV.empty?).each { |t| puts t }
156
168
  when /^f.*/
157
169
  task = x.finish(ARGV.first.to_i).desc
158
170
  puts "finish task: #{task}"
@@ -1,3 +1,3 @@
1
1
  module NeverDo
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: never_do
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - delta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-04 00:00:00.000000000 Z
11
+ date: 2017-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,6 +72,7 @@ files:
72
72
  - lib/never_do.rb
73
73
  - lib/never_do/version.rb
74
74
  - never_do.gemspec
75
+ - screenshots/usage.png
75
76
  homepage: https://github.com/delta4d/never_do
76
77
  licenses:
77
78
  - MIT
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project:
95
- rubygems_version: 2.4.5.1
96
+ rubygems_version: 2.6.11
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: command line todo app