francois-tt 0.0.1 → 0.0.2
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/Rakefile +1 -1
- data/bin/pi +6 -0
- data/bin/po +6 -0
- data/bin/tt +24 -0
- data/lib/tt.rb +10 -16
- metadata +8 -3
data/Rakefile
CHANGED
data/bin/pi
ADDED
data/bin/po
ADDED
data/bin/tt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "rubygems"
|
3
|
+
$: << File.dirname(__FILE__) + "/../lib"
|
4
|
+
require "tt"
|
5
|
+
|
6
|
+
case command = ARGV.shift
|
7
|
+
when "list", "ls"
|
8
|
+
Tt.report
|
9
|
+
when "clear"
|
10
|
+
Tt.clear
|
11
|
+
when "drop"
|
12
|
+
Tt.drop
|
13
|
+
else
|
14
|
+
puts <<EOF
|
15
|
+
WARNING: No command given
|
16
|
+
|
17
|
+
tt - Time Tracker
|
18
|
+
|
19
|
+
list: lists the time entries
|
20
|
+
clear: deletes all time entries
|
21
|
+
drop: drops the last time entry from the file
|
22
|
+
EOF
|
23
|
+
exit 1
|
24
|
+
end
|
data/lib/tt.rb
CHANGED
@@ -30,22 +30,16 @@ module Tt
|
|
30
30
|
|
31
31
|
def self.report_line(dir, intime, outtime, comment)
|
32
32
|
ltime = Time.now
|
33
|
-
intime = intime + ltime.utc_offset
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
puts
|
44
|
-
else
|
45
|
-
print "%-40s %16s %16s %5s" % [dir, intime.strftime(SCREEN_FORMAT), "", ""]
|
46
|
-
print " - %s" % comment if comment && !comment.empty?
|
47
|
-
puts
|
48
|
-
end
|
33
|
+
intime = intime + ltime.utc_offset
|
34
|
+
endtime = (outtime.nil? ? Time.now.utc : outtime) + ltime.utc_offset
|
35
|
+
|
36
|
+
duration_in_seconds = endtime - intime
|
37
|
+
duration_in_minutes = duration_in_seconds / 60
|
38
|
+
duration_as_human_string = "%02d:%02d" % [duration_in_minutes / 60, duration_in_minutes % 60]
|
39
|
+
|
40
|
+
print "%-40s %16s %16s %5s" % [dir, intime.strftime(SCREEN_FORMAT), outtime ? outtime.strftime(SCREEN_FORMAT) : "", duration_as_human_string]
|
41
|
+
print " - %s" % comment if comment && !comment.empty?
|
42
|
+
puts
|
49
43
|
end
|
50
44
|
|
51
45
|
def self.report
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: francois-tt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Fran\xC3\xA7ois Beausoleil"
|
@@ -23,8 +23,10 @@ dependencies:
|
|
23
23
|
version:
|
24
24
|
description: Track your time locally, offline, using this simple tool.
|
25
25
|
email: francois@teksol.info
|
26
|
-
executables:
|
27
|
-
|
26
|
+
executables:
|
27
|
+
- tt
|
28
|
+
- pi
|
29
|
+
- po
|
28
30
|
extensions: []
|
29
31
|
|
30
32
|
extra_rdoc_files:
|
@@ -37,6 +39,9 @@ files:
|
|
37
39
|
- Rakefile
|
38
40
|
- TODO
|
39
41
|
- lib/tt.rb
|
42
|
+
- bin/tt
|
43
|
+
- bin/pi
|
44
|
+
- bin/po
|
40
45
|
has_rdoc: true
|
41
46
|
homepage: http://github.com/francois/tt
|
42
47
|
post_install_message:
|