swatch 0.2 → 0.2.1
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.
- data/CHANGELOG.rdoc +10 -0
- data/README.rdoc +25 -0
- data/bin/swatch +11 -4
- data/lib/swatch.rb +10 -0
- metadata +2 -1
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -2,3 +2,28 @@
|
|
2
2
|
|
3
3
|
A simple command line utility in Ruby to track your time.
|
4
4
|
Can be use with todo.txt task list.
|
5
|
+
|
6
|
+
== Usage
|
7
|
+
|
8
|
+
swatch command [option] arg
|
9
|
+
|
10
|
+
Going in a task :
|
11
|
+
swatch in My awesome task
|
12
|
+
|
13
|
+
Getting out:
|
14
|
+
swatch out
|
15
|
+
|
16
|
+
Timing a todo.txt task:
|
17
|
+
swatch in -t 42
|
18
|
+
|
19
|
+
== Config
|
20
|
+
|
21
|
+
Swatch look for the ~/.swatchrc file. If it's present swatch will parse it to get track_file and todo_file path.
|
22
|
+
Exemple :
|
23
|
+
track_file = "~/todo/swatchtrack.txt"
|
24
|
+
todo_file = "~/todo/todo.txt"
|
25
|
+
|
26
|
+
By default (i.e if there is no ~/.swatchrc file), swatch will look for todo file in ~/.todo.txt and track_file in ~/.swatch.txt.
|
27
|
+
|
28
|
+
== Todo
|
29
|
+
* parse todo to remove the priority
|
data/bin/swatch
CHANGED
@@ -11,15 +11,23 @@
|
|
11
11
|
|
12
12
|
require 'trollop'
|
13
13
|
require 'swatch'
|
14
|
+
require ('parseconfig')
|
14
15
|
|
15
16
|
# ###############
|
16
17
|
# Global variable
|
17
18
|
# ###############
|
18
19
|
|
19
20
|
CONF_FILE = File.expand_path("~/.swatchrc")
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
VERSION = '0.2.1'
|
22
|
+
|
23
|
+
if File.exist? CONF_FILE
|
24
|
+
config = ParseConfig.new(CONF_FILE)
|
25
|
+
TRACK_FILE = File.expand_path config.get_value 'track_file'
|
26
|
+
TODO_FILE = File.expand_path config.get_value 'todo_file'
|
27
|
+
else
|
28
|
+
TRACK_FILE = File.expand_path("~/.swatch.txt")
|
29
|
+
TODO_FILE = File.expand_path("~/.todo.txt")
|
30
|
+
end
|
23
31
|
|
24
32
|
# #####################
|
25
33
|
# Subcommand definition
|
@@ -48,7 +56,6 @@ end
|
|
48
56
|
cmd = ARGV.shift # get the subcommand
|
49
57
|
cmd_opts = case cmd
|
50
58
|
when "in", "i"
|
51
|
-
# TODO add todo.txt support
|
52
59
|
Trollop::options do
|
53
60
|
opt :todo, "Track a todo.txt task", :type => :int, :short => "-t"
|
54
61
|
end
|
data/lib/swatch.rb
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
#
|
2
|
+
#------------------------------------------------------------------------------
|
3
|
+
# "THE BEER-WARE LICENSE" (Revision 42):
|
4
|
+
# <mayeu.tik@gmail.com> wrote this file. As long as you retain this notice you
|
5
|
+
# can do whatever you want with this stuff. If we meet some day, and you think
|
6
|
+
# this stuff is worth it, you can buy me a beer in return. Matthieu Maury
|
7
|
+
#------------------------------------------------------------------------------
|
8
|
+
#
|
9
|
+
|
1
10
|
module Swatch
|
2
11
|
|
3
12
|
module_function
|
@@ -65,6 +74,7 @@ module Swatch
|
|
65
74
|
|
66
75
|
# Return the todo associated to the given number
|
67
76
|
def get_todo (nb)
|
77
|
+
# TODO: parse todo to remove the priority
|
68
78
|
IO.readlines(TODO_FILE)[nb-1]
|
69
79
|
end
|
70
80
|
|