timetrap 1.3.0 → 1.4.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.
- data/README.md +18 -10
- data/VERSION.yml +1 -1
- data/lib/timetrap/cli.rb +12 -9
- data/spec/timetrap_spec.rb +8 -0
- data/timetrap.gemspec +2 -2
- metadata +2 -2
data/README.md
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
Timetrap
|
2
2
|
========
|
3
3
|
|
4
|
-
Timetrap is a
|
5
|
-
tracking what you spend your time on.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
Timetrap is a simple command line time tracker written in ruby. It provides an
|
5
|
+
easy to use command line interface for tracking what you spend your time on.
|
6
|
+
|
7
|
+
It began as a ruby port of Trevor Caira's Timebook, a small python utility. It
|
8
|
+
contains several enhancement over Timebook, notably the ability to parse
|
9
|
+
natural language times (e.g. "30 minutes ago"), additional commands such as
|
10
|
+
`archive` and `configure`, and support for rounding.
|
11
|
+
|
12
|
+
Timetrap is also able to export entries to several formats (e.g. ical, csv) and
|
13
|
+
is designed to be easily extended to support additional export formats, by
|
14
|
+
creating a new formatter class (in ruby.)
|
15
|
+
|
11
16
|
Timetrap maintains its state in a sqlite3 database.
|
12
17
|
|
13
18
|
Timetrap is available as a gem on gemcutter (http://gemcutter.org/gems/timetrap)
|
@@ -35,7 +40,7 @@ time sheet may only have one period running at once.
|
|
35
40
|
Interactions with timetrap are performed through the ``t`` command on the
|
36
41
|
command line. ``t`` is followed by one of timetrap's subcommands. Often used
|
37
42
|
subcommands include ``in``, ``out``, ``switch``, ``now``, ``list`` and
|
38
|
-
``display``. Commands may be abbreviated as long as they are unambiguous
|
43
|
+
``display``. *Commands may be abbreviated as long as they are unambiguous.* thus
|
39
44
|
``t switch foo`` and ``t s foo`` are identical. With the default command set,
|
40
45
|
no two commands share the first same letter, thus it is only necessary to type
|
41
46
|
the first letter of a command. Likewise, commands which display timesheets
|
@@ -105,7 +110,8 @@ Commands
|
|
105
110
|
**configure**
|
106
111
|
Creates a config file at ``~/.timetrap.yml`` or ``ENV['TIMETRAP_CONFIG_FILE']`` if
|
107
112
|
one doesn't exist. Prints path to config file. Currently allows configuration
|
108
|
-
of path to database file
|
113
|
+
of path to database file, and the number of seconds used when the `--round`
|
114
|
+
flag is set (defaults to 15 minutes.)
|
109
115
|
|
110
116
|
usage: ``t configure``
|
111
117
|
|
@@ -120,7 +126,7 @@ Commands
|
|
120
126
|
text. iCal and csv output are also supported.
|
121
127
|
|
122
128
|
Display also allows the use of a ``--round`` or ``-r`` flag which will round
|
123
|
-
all times
|
129
|
+
all times in the output. See global options below.
|
124
130
|
|
125
131
|
usage: ``t display [--ids] [--round] [--start DATE] [--end DATE] [--format FMT] [SHEET | all]``
|
126
132
|
|
@@ -190,6 +196,8 @@ Global Options
|
|
190
196
|
display commands (e.g. display, list, week, etc.) and is non-destructive.
|
191
197
|
The actual start and end time stored by Timetrap are unaffected.
|
192
198
|
|
199
|
+
See `configure` command to change rounding increment from 15 minutes.
|
200
|
+
|
193
201
|
Configuration
|
194
202
|
--------
|
195
203
|
|
data/VERSION.yml
CHANGED
data/lib/timetrap/cli.rb
CHANGED
@@ -54,8 +54,9 @@ where COMMAND is one of:
|
|
54
54
|
usage: t week [--ids] [--end DATE] [--format FMT] [SHEET | all]
|
55
55
|
|
56
56
|
OTHER OPTIONS
|
57
|
-
-h, --help
|
58
|
-
-r, --round
|
57
|
+
-h, --help Display this help
|
58
|
+
-r, --round Round output to 15 minute start and end times.
|
59
|
+
-y, --yes Noninteractive, assume yes as answer to all prompts
|
59
60
|
|
60
61
|
Submit bugs and feature requests to http://github.com/samg/timetrap/issues
|
61
62
|
EOF
|
@@ -95,9 +96,7 @@ where COMMAND is one of:
|
|
95
96
|
|
96
97
|
def archive
|
97
98
|
ee = selected_entries
|
98
|
-
|
99
|
-
print out
|
100
|
-
if $stdin.gets =~ /\Aye?s?\Z/i
|
99
|
+
if ask_user "Archive #{ee.count} entries? "
|
101
100
|
ee.all.each do |e|
|
102
101
|
next unless e.end
|
103
102
|
e.update :sheet => "_#{e.sheet}"
|
@@ -136,8 +135,7 @@ where COMMAND is one of:
|
|
136
135
|
if e = Entry[args['-i']]
|
137
136
|
out = "are you sure you want to delete entry #{e.id}? "
|
138
137
|
out << "(#{e.note}) " if e.note.to_s =~ /.+/
|
139
|
-
|
140
|
-
if $stdin.gets =~ /\Aye?s?\Z/i
|
138
|
+
if ask_user out
|
141
139
|
e.destroy
|
142
140
|
say "it's dead"
|
143
141
|
else
|
@@ -145,8 +143,7 @@ where COMMAND is one of:
|
|
145
143
|
end
|
146
144
|
elsif (sheets = Entry.map{|e| e.sheet }.uniq).include?(sheet = unused_args)
|
147
145
|
victims = Entry.filter(:sheet => sheet).count
|
148
|
-
|
149
|
-
if $stdin.gets =~ /\Aye?s?\Z/i
|
146
|
+
if ask_user "are you sure you want to delete #{victims} entries on sheet #{sheet.inspect}? "
|
150
147
|
Timetrap.kill_sheet sheet
|
151
148
|
say "killed #{victims} entries"
|
152
149
|
else
|
@@ -231,5 +228,11 @@ where COMMAND is one of:
|
|
231
228
|
args.unused.join(' ')
|
232
229
|
end
|
233
230
|
|
231
|
+
def ask_user question
|
232
|
+
return true if args['-y']
|
233
|
+
print question
|
234
|
+
$stdin.gets =~ /\Aye?s?\Z/i
|
235
|
+
end
|
236
|
+
|
234
237
|
end
|
235
238
|
end
|
data/spec/timetrap_spec.rb
CHANGED
@@ -357,6 +357,14 @@ END:VCALENDAR
|
|
357
357
|
invoke "kill --id #{entry.id}"
|
358
358
|
end.should change(Timetrap::Entry, :count).by(-1)
|
359
359
|
end
|
360
|
+
|
361
|
+
it "should not prompt the user if the --yes flag is passed" do
|
362
|
+
create_entry
|
363
|
+
entry = create_entry
|
364
|
+
lambda do
|
365
|
+
invoke "kill --id #{entry.id} --yes"
|
366
|
+
end.should change(Timetrap::Entry, :count).by(-1)
|
367
|
+
end
|
360
368
|
end
|
361
369
|
|
362
370
|
describe "list" do
|
data/timetrap.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{timetrap}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sam Goldstein"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-17}
|
13
13
|
s.default_executable = %q{t}
|
14
14
|
s.description = %q{Command line time tracker}
|
15
15
|
s.email = %q{sgrock@gmail.com}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timetrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Goldstein
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-06-17 00:00:00 -07:00
|
13
13
|
default_executable: t
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|