tod-gem 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -0
- data/bin/tod +14 -7
- data/tod-gem.gemspec +8 -8
- 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: 316c0db9ee8e4d1d8f06cbc8a88dad4353d27b06
|
4
|
+
data.tar.gz: 8a15944e15fa5bcc947742f66012b8aeb825e31c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d4eeacee2f51f1d34830169bf68e040818a3ef14c27294055f0cf3265c679239b9a8c12c1484a16105b6e8cc7133ca930b31afe1617e7f25c5ee9a1317758bd
|
7
|
+
data.tar.gz: 2dfde49506997c1b3805ff37b316266c7f38844554714d3a47768fdef4b9fef576ca4d1cde9148396ef1f4843e78a1d8e6b1a363f24fdd0f19d75ea7a7c584a6
|
data/README.md
CHANGED
@@ -3,6 +3,34 @@ tod
|
|
3
3
|
|
4
4
|
A simple command line todo manager
|
5
5
|
|
6
|
+
Overview
|
7
|
+
--------
|
8
|
+
I was looking for a simple cli todo manager, but couldn't find one. Either they were too sophisticated or their documentation was unreadable, so I decided to create a very, very simple one myself.
|
9
|
+
Say hi to tod.
|
10
|
+
|
11
|
+
Installation
|
12
|
+
------------
|
13
|
+
|
14
|
+
gem install tod-gem
|
15
|
+
|
16
|
+
(you may need to run it with sudo on some systems)
|
17
|
+
|
18
|
+
Usage
|
19
|
+
-----
|
20
|
+
* Simply running `tod` will list current pending todos in current directory.
|
21
|
+
|
22
|
+
* `tod add 'buy a new pen'` creates a new todo named 'buy a new pen'.
|
23
|
+
|
24
|
+
* `tod done 'buy a new'` finds the first todo containing the provided string in its name and marks it as done.
|
25
|
+
|
26
|
+
* `tod all` lists all todos in current directory - including marked as done.
|
27
|
+
|
28
|
+
* `tod finished` lists only marked as done todos in current directory.
|
29
|
+
|
30
|
+
* `tod clear` permanently deletes todos marked as done from the register of current directory.
|
31
|
+
|
32
|
+
The todo register is kept in the file named `.todfile` once you create at least one todo in given directory. This way you can add the file to a git or svn repository and distribute it between machines.
|
33
|
+
|
6
34
|
License
|
7
35
|
-------
|
8
36
|
Copyright 2013 Michal Siwek
|
data/bin/tod
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'colorize'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
def find_todfile(path)
|
5
|
+
expanded_path = File.expand_path(path)
|
6
|
+
return File.expand_path("#{path}/.todfile") if File.exists?("#{path}/.todfile") || expanded_path == "/" || expanded_path == ENV['HOME']
|
7
|
+
find_todfile("../#{path}")
|
8
|
+
end
|
6
9
|
|
7
10
|
def list(kind = 'left')
|
8
11
|
if @todfile_exists
|
9
|
-
File.open(
|
12
|
+
File.open(@todfile_path).each_line do |line|
|
10
13
|
unless kind == 'done'
|
11
14
|
if line.chars.first == '-'
|
12
15
|
puts '*'.yellow + line.reverse.chop.reverse
|
@@ -29,7 +32,7 @@ def list(kind = 'left')
|
|
29
32
|
end
|
30
33
|
|
31
34
|
def add(todo)
|
32
|
-
File.open(
|
35
|
+
File.open(@todfile_path, 'a') do |todfile|
|
33
36
|
todfile.puts '- ' + todo
|
34
37
|
end
|
35
38
|
end
|
@@ -38,7 +41,7 @@ def done(todo)
|
|
38
41
|
if @todfile_exists
|
39
42
|
newlines = []
|
40
43
|
|
41
|
-
File.open(
|
44
|
+
File.open(@todfile_path).each_line do |line|
|
42
45
|
unless line.include?(todo)
|
43
46
|
newlines << line.chomp
|
44
47
|
else
|
@@ -54,7 +57,7 @@ def clear_done
|
|
54
57
|
if @todfile_exists
|
55
58
|
newlines = []
|
56
59
|
|
57
|
-
File.open(
|
60
|
+
File.open(@todfile_path).each_line do |line|
|
58
61
|
newlines << line unless line.chars.first == '+'
|
59
62
|
end
|
60
63
|
|
@@ -63,11 +66,15 @@ def clear_done
|
|
63
66
|
end
|
64
67
|
|
65
68
|
def replace_todfile_with(lines)
|
66
|
-
File.open(
|
69
|
+
File.open(@todfile_path, 'w') do |todfile|
|
67
70
|
lines.each { |line| todfile.puts line }
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
74
|
+
@command = ARGV[0]
|
75
|
+
@todfile_path = find_todfile(".")
|
76
|
+
@todfile_exists = File.exists?(@todfile_path)
|
77
|
+
|
71
78
|
case @command
|
72
79
|
when nil
|
73
80
|
list
|
data/tod-gem.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
|
-
s.name
|
3
|
-
s.version
|
4
|
-
s.summary
|
5
|
-
s.authors
|
6
|
-
s.email
|
7
|
-
s.license
|
8
|
-
s.files
|
9
|
-
s.executables
|
2
|
+
s.name = 'tod-gem'
|
3
|
+
s.version = '0.2'
|
4
|
+
s.summary = 'Simple command line todo manager'
|
5
|
+
s.authors = ['Michal Siwek']
|
6
|
+
s.email = 'mike21@aol.pl'
|
7
|
+
s.license = 'GPL-3.0'
|
8
|
+
s.files = `git ls-files`.split("\n")
|
9
|
+
s.executables = ['tod']
|
10
10
|
|
11
11
|
s.add_runtime_dependency 'colorize'
|
12
12
|
end
|