habiter 0.1.2 → 0.1.3
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/README +6 -0
- data/bin/habiter +12 -6
- metadata +1 -1
data/README
CHANGED
@@ -15,3 +15,9 @@ jog is not a habit yet. create and complete it? (y/n) y
|
|
15
15
|
~$ habiter log
|
16
16
|
jog | ------------------------------+
|
17
17
|
clean_room | ------------------------------+
|
18
|
+
|
19
|
+
Install
|
20
|
+
-------
|
21
|
+
|
22
|
+
Install with 'gem install habiter' if you have gemcutter set up as a
|
23
|
+
repository
|
data/bin/habiter
CHANGED
@@ -55,20 +55,26 @@ end
|
|
55
55
|
def log(options={})
|
56
56
|
options[:days] = 30 unless options[:days]
|
57
57
|
name_column_width = @habits.max {|a,b| a.length <=> b.length}[0].length
|
58
|
+
day = Date.today - options[:days]
|
59
|
+
print " " * (name_column_width + 2)
|
60
|
+
(0..options[:days]).each do |i|
|
61
|
+
print (day + (i)).strftime('%a')[0].chr.swapcase.colorize(36)
|
62
|
+
end
|
63
|
+
puts
|
58
64
|
@habits.each do |habit, times|
|
59
|
-
day = Date.today - options[:days]
|
60
|
-
print sprintf("%#{name_column_width}s ", habit)
|
61
|
-
print "|".colorize(32)
|
65
|
+
day = Date.today - (options[:days])
|
66
|
+
print (sprintf("%#{name_column_width}s ", habit) + "|").colorize(36)
|
62
67
|
times.collect! do |time|
|
63
68
|
time.to_date
|
64
69
|
end
|
65
70
|
(0..options[:days]).each do |i|
|
66
71
|
if times.include? day
|
67
|
-
print "+"
|
72
|
+
print "+"
|
73
|
+
#print "+".colorize(34)
|
68
74
|
else
|
69
|
-
print "
|
75
|
+
print " "
|
70
76
|
end
|
71
|
-
day +=
|
77
|
+
day += 1
|
72
78
|
end
|
73
79
|
puts
|
74
80
|
end
|