timr 0.5.0 → 0.6.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.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/bin/.gitignore +1 -0
- data/bin/build_man.sh +1 -0
- data/bin/dev_data.sh +57 -0
- data/bin/dev_setup.sh +2 -0
- data/bin/test.sh +3 -1
- data/bin/test_report.sh +82 -0
- data/bin/timr_bash_completion.sh +13 -1
- data/lib/timr.rb +1 -0
- data/lib/timr/command/basic_command.rb +2 -0
- data/lib/timr/command/log_command.rb +3 -3
- data/lib/timr/command/report_command.rb +109 -71
- data/lib/timr/command/reset_command.rb +75 -0
- data/lib/timr/duration.rb +5 -1
- data/lib/timr/exception/timr_error.rb +4 -0
- data/lib/timr/model/stack.rb +8 -0
- data/lib/timr/model/task.rb +41 -9
- data/lib/timr/model/track.rb +47 -15
- data/lib/timr/timr.rb +45 -3
- data/lib/timr/version.rb +2 -2
- data/man/index.txt +1 -0
- data/man/timr-report.1 +66 -21
- data/man/timr-report.1.ronn +30 -1
- data/man/timr-reset.1 +41 -0
- data/man/timr-reset.1.ronn +33 -0
- data/man/timr.1 +3 -0
- data/man/timr.1.ronn +1 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3948415c9078720d4fa8086cc8ce9c234ddd5e88
|
4
|
+
data.tar.gz: ee3a6ce0a660c31fb89a343d5e34ed8502e0c6eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e36359864dc8d6004ccc34176e77902e02c4a31e419423d4bc4f2c408ca4024b4e68459e40f6a52c18a2f60c11902c2f84d2da988864510145ce70c18b663aa
|
7
|
+
data.tar.gz: 377b2341c3f240d688fa8b4d4e4e61c597e85086c1e296fa3e3023b238a54f178d4a1b59528c346d3d82f8cef99b38b1ba1075c333d8c09f1754869ca4d65c9c
|
data/README.md
CHANGED
@@ -158,6 +158,14 @@ Export Tasks and Tracks.
|
|
158
158
|
|
159
159
|
See more informations on the [timr-report(1)](https://timr.fox21.at/man/timr-report.1.html) man page.
|
160
160
|
|
161
|
+
### Reset Command
|
162
|
+
|
163
|
+
Remove current running Track.
|
164
|
+
|
165
|
+
timr reset [<options>]
|
166
|
+
|
167
|
+
See more informations on the [timr-reset(1)](https://timr.fox21.at/man/timr-reset.1.html) man page.
|
168
|
+
|
161
169
|
## Workflow Example
|
162
170
|
|
163
171
|
Here is an example as shell commands how your workflow could look like while using Timr.
|
data/bin/.gitignore
CHANGED
data/bin/build_man.sh
CHANGED
data/bin/dev_data.sh
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Generate dev data.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
|
7
|
+
|
8
|
+
set -e
|
9
|
+
cd "${SCRIPT_BASEDIR}/.."
|
10
|
+
|
11
|
+
cwd="tmp/dev"
|
12
|
+
mkdir -p "$cwd"
|
13
|
+
|
14
|
+
bundler exec ./bin/timr -C "$cwd" task add --id t1 -n t1
|
15
|
+
bundler exec ./bin/timr -C "$cwd" task add --id t2 -n t2
|
16
|
+
bundler exec ./bin/timr -C "$cwd" task add --id t3 -n t3
|
17
|
+
bundler exec ./bin/timr -C "$cwd" task add --id t4 -n t4
|
18
|
+
|
19
|
+
# Show Tasks
|
20
|
+
bundler exec ./bin/timr -C "$cwd" task show t1
|
21
|
+
bundler exec ./bin/timr -C "$cwd" task show t2
|
22
|
+
bundler exec ./bin/timr -C "$cwd" task show t3
|
23
|
+
bundler exec ./bin/timr -C "$cwd" task show t4
|
24
|
+
|
25
|
+
# Task 1
|
26
|
+
bundler exec ./bin/timr -C "$cwd" track add \
|
27
|
+
--start-date 2017-01-01 --start-time 01:00 \
|
28
|
+
--end-date 2017-01-01 --end-time 02:00 \
|
29
|
+
--billed \
|
30
|
+
-m 'task1_track1' t1
|
31
|
+
|
32
|
+
bundler exec ./bin/timr -C "$cwd" track add \
|
33
|
+
--start-date 2017-01-02 --start-time 01:00 \
|
34
|
+
--end-date 2017-01-02 --end-time 03:00 \
|
35
|
+
-m 'task1_track2' t1
|
36
|
+
|
37
|
+
# Task 3
|
38
|
+
bundler exec ./bin/timr -C "$cwd" track add \
|
39
|
+
--start-date 2017-01-03 --start-time 01:00 \
|
40
|
+
--end-date 2017-01-03 --end-time 03:00 \
|
41
|
+
-m 'task3_track1' t3
|
42
|
+
|
43
|
+
bundler exec ./bin/timr -C "$cwd" track add t3
|
44
|
+
|
45
|
+
# Task 4
|
46
|
+
bundler exec ./bin/timr -C "$cwd" track add \
|
47
|
+
--start-date 2017-01-04 --start-time 01:00 \
|
48
|
+
--end-date 2017-01-04 --end-time 04:00 \
|
49
|
+
-m 'task4_track1' t4
|
50
|
+
|
51
|
+
bundler exec ./bin/timr -C "$cwd" track add t4
|
52
|
+
|
53
|
+
bundler exec ./bin/timr -C "$cwd" start t4 -t 01:00
|
54
|
+
bundler exec ./bin/timr -C "$cwd" stop -t 02:00
|
55
|
+
|
56
|
+
bundler exec ./bin/timr -C "$cwd" start t1 -t 03:00
|
57
|
+
bundler exec ./bin/timr -C "$cwd" push t2
|
data/bin/dev_setup.sh
CHANGED
data/bin/test.sh
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
# Run
|
3
|
+
# Run all Tests.
|
4
4
|
|
5
5
|
SCRIPT_BASEDIR=$(dirname "$0")
|
6
6
|
RUBYOPT=-w
|
@@ -17,3 +17,5 @@ cd "${SCRIPT_BASEDIR}/.."
|
|
17
17
|
grep -r -i taks lib man test && { echo 'ERROR: Wrong word found'; exit 1; } || true
|
18
18
|
|
19
19
|
bundler exec ./test/suite_all.rb
|
20
|
+
|
21
|
+
./bin/test_report.sh
|
data/bin/test_report.sh
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Test Report Command.
|
4
|
+
|
5
|
+
DATE=$(date +"%F_%H%M%S")
|
6
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
7
|
+
|
8
|
+
|
9
|
+
set -e
|
10
|
+
cd "${SCRIPT_BASEDIR}/.."
|
11
|
+
option=$1
|
12
|
+
|
13
|
+
mkdir -p tmp
|
14
|
+
tmpdir=$(mktemp -d tmp/test_report_XXXXX)
|
15
|
+
cwd="${tmpdir}/defaultc"
|
16
|
+
tasks_csv_file="${tmpdir}/tasks.csv"
|
17
|
+
tracks_csv_file="${tmpdir}/tracks.csv"
|
18
|
+
|
19
|
+
bundler exec ./bin/timr -C "$cwd" task add --id t1 -n t1 # full
|
20
|
+
bundler exec ./bin/timr -C "$cwd" task add --id t2 -n t2 # empty
|
21
|
+
bundler exec ./bin/timr -C "$cwd" task add --id t3 -n t3 # includes a normal track and empty track
|
22
|
+
bundler exec ./bin/timr -C "$cwd" task add --id t4 -n t4 # includes only an empty track
|
23
|
+
|
24
|
+
# Show Tasks
|
25
|
+
bundler exec ./bin/timr -C "$cwd" task show t1
|
26
|
+
bundler exec ./bin/timr -C "$cwd" task show t2
|
27
|
+
bundler exec ./bin/timr -C "$cwd" task show t3
|
28
|
+
bundler exec ./bin/timr -C "$cwd" task show t4
|
29
|
+
|
30
|
+
# Task 1
|
31
|
+
bundler exec ./bin/timr -C "$cwd" track add \
|
32
|
+
--start-date 2017-01-01 --start-time 01:00 \
|
33
|
+
--end-date 2017-01-01 --end-time 02:00 \
|
34
|
+
--billed \
|
35
|
+
-m 'task1_track1' t1
|
36
|
+
|
37
|
+
bundler exec ./bin/timr -C "$cwd" track add \
|
38
|
+
--start-date 2017-01-02 --start-time 01:00 \
|
39
|
+
--end-date 2017-01-02 --end-time 03:00 \
|
40
|
+
-m 'task1_track2' t1
|
41
|
+
|
42
|
+
# Task 2 empty
|
43
|
+
|
44
|
+
# Task 3
|
45
|
+
bundler exec ./bin/timr -C "$cwd" track add \
|
46
|
+
--start-date 2017-01-03 --start-time 01:00 \
|
47
|
+
--end-date 2017-01-03 --end-time 03:00 \
|
48
|
+
-m 'task3_track1' t3
|
49
|
+
|
50
|
+
bundler exec ./bin/timr -C "$cwd" track add t3
|
51
|
+
|
52
|
+
# Task 4
|
53
|
+
bundler exec ./bin/timr -C "$cwd" track add \
|
54
|
+
--start-date 2017-01-04 --start-time 01:00 \
|
55
|
+
--end-date 2017-01-04 --end-time 04:00 \
|
56
|
+
-m 'task4_track1' t4
|
57
|
+
|
58
|
+
bundler exec ./bin/timr -C "$cwd" track add t4
|
59
|
+
|
60
|
+
# Show Tasks
|
61
|
+
bundler exec ./bin/timr -C "$cwd" task show t1
|
62
|
+
bundler exec ./bin/timr -C "$cwd" task show t2
|
63
|
+
bundler exec ./bin/timr -C "$cwd" task show t3
|
64
|
+
bundler exec ./bin/timr -C "$cwd" task show t4
|
65
|
+
|
66
|
+
# Report to STDOUT.
|
67
|
+
bundler exec ./bin/timr -C "$cwd" report --tasks --all
|
68
|
+
bundler exec ./bin/timr -C "$cwd" report --tasks --all --billed
|
69
|
+
bundler exec ./bin/timr -C "$cwd" report --tasks --all --unbilled
|
70
|
+
bundler exec ./bin/timr -C "$cwd" report --tracks --all
|
71
|
+
bundler exec ./bin/timr -C "$cwd" report --tracks --all --billed
|
72
|
+
bundler exec ./bin/timr -C "$cwd" report --tracks --all --unbilled
|
73
|
+
|
74
|
+
# Report to files.
|
75
|
+
bundler exec ./bin/timr -C "$cwd" report --tasks --all --csv "${tasks_csv_file}"
|
76
|
+
bundler exec ./bin/timr -C "$cwd" report --tracks --all --csv "${tracks_csv_file}"
|
77
|
+
|
78
|
+
# Open under macOS.
|
79
|
+
if [[ "$option" = "-o" ]]; then
|
80
|
+
open "${tasks_csv_file}"
|
81
|
+
open "${tracks_csv_file}"
|
82
|
+
fi
|
data/bin/timr_bash_completion.sh
CHANGED
@@ -12,6 +12,7 @@ function _timr_command {
|
|
12
12
|
pop
|
13
13
|
push
|
14
14
|
report
|
15
|
+
reset
|
15
16
|
start
|
16
17
|
status
|
17
18
|
stop
|
@@ -103,6 +104,8 @@ function _timr_report_main {
|
|
103
104
|
--all
|
104
105
|
--tasks
|
105
106
|
--tracks
|
107
|
+
--billed
|
108
|
+
--unbilled
|
106
109
|
--format
|
107
110
|
--csv
|
108
111
|
--force
|
@@ -110,6 +113,15 @@ function _timr_report_main {
|
|
110
113
|
COMPREPLY=( $(compgen -W '${timr_commands[@]}' -- "${curr_word}") )
|
111
114
|
}
|
112
115
|
|
116
|
+
function _timr_reset_main {
|
117
|
+
local curr_word=$1
|
118
|
+
local timr_commands=(
|
119
|
+
--help
|
120
|
+
--stack
|
121
|
+
)
|
122
|
+
COMPREPLY=( $(compgen -W '${timr_commands[@]}' -- "${curr_word}") )
|
123
|
+
}
|
124
|
+
|
113
125
|
function _timr_start_main {
|
114
126
|
local curr_word=$1
|
115
127
|
local timr_commands=(
|
@@ -308,7 +320,7 @@ function _timr_main {
|
|
308
320
|
fi
|
309
321
|
|
310
322
|
case "${timr_command}" in
|
311
|
-
continue|log|pause|pop|push|report|start|status|stop)
|
323
|
+
continue|log|pause|pop|push|report|reset|start|status|stop)
|
312
324
|
"_timr_${timr_command}_main" "$curr_word"
|
313
325
|
;;
|
314
326
|
task|track)
|
data/lib/timr.rb
CHANGED
@@ -29,6 +29,7 @@ require 'timr/command/pause_command'
|
|
29
29
|
require 'timr/command/pop_command'
|
30
30
|
require 'timr/command/push_command'
|
31
31
|
require 'timr/command/report_command'
|
32
|
+
require 'timr/command/reset_command'
|
32
33
|
require 'timr/command/start_command'
|
33
34
|
require 'timr/command/status_command'
|
34
35
|
require 'timr/command/stop_command'
|
@@ -189,7 +189,7 @@ module TheFox
|
|
189
189
|
track_c,
|
190
190
|
begin_datetime_s,
|
191
191
|
end_datetime_s,
|
192
|
-
duration
|
192
|
+
duration.to_human_s,
|
193
193
|
task.id_foreign_or_short,
|
194
194
|
'%s %s' % [track.short_id, track.title(15)],
|
195
195
|
]
|
@@ -219,7 +219,7 @@ module TheFox
|
|
219
219
|
totals[:task_c],
|
220
220
|
begin_datetime_s,
|
221
221
|
end_datetime_s,
|
222
|
-
duration
|
222
|
+
duration.to_human_s,
|
223
223
|
task.id_foreign_or_short,
|
224
224
|
'%s %s' % [track.short_id, track.title(15)],
|
225
225
|
]
|
@@ -237,7 +237,7 @@ module TheFox
|
|
237
237
|
nil, # track_c
|
238
238
|
totals[:begin_datetime_s],
|
239
239
|
totals[:end_datetime_s],
|
240
|
-
totals[:duration]
|
240
|
+
totals[:duration].to_human_s, # duration
|
241
241
|
'TOTAL', # task
|
242
242
|
nil, # track
|
243
243
|
]
|
@@ -18,15 +18,14 @@ module TheFox
|
|
18
18
|
|
19
19
|
def initialize(argv = Array.new)
|
20
20
|
super()
|
21
|
-
# puts "argv '#{argv}'"
|
22
21
|
|
23
22
|
@help_opt = false
|
24
23
|
@tasks_opt = false
|
25
24
|
@tracks_opt = false
|
26
25
|
@from_opt = nil
|
27
26
|
@to_opt = nil
|
28
|
-
|
29
|
-
|
27
|
+
@billed_opt = false
|
28
|
+
@unbilled_opt = false
|
30
29
|
@format_opt = nil
|
31
30
|
@csv_opt = nil
|
32
31
|
@force_opt = false
|
@@ -56,10 +55,10 @@ module TheFox
|
|
56
55
|
when '-t', '--tracks'
|
57
56
|
@tracks_opt = true
|
58
57
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
when '--billed'
|
59
|
+
@billed_opt = true
|
60
|
+
when '--unbilled'
|
61
|
+
@unbilled_opt = true
|
63
62
|
|
64
63
|
when '--format'
|
65
64
|
@format_opt = argv.shift
|
@@ -86,20 +85,20 @@ module TheFox
|
|
86
85
|
@to_opt = Time.new(today.year, today.month, month_end.day, 23, 59, 59)
|
87
86
|
end
|
88
87
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
88
|
+
@billed_resolved_opt = nil
|
89
|
+
if @billed_opt || @unbilled_opt
|
90
|
+
if @billed_opt
|
91
|
+
@billed_resolved_opt = true
|
92
|
+
elsif @unbilled_opt
|
93
|
+
@billed_resolved_opt = false
|
94
|
+
end
|
95
|
+
end
|
97
96
|
|
98
97
|
@filter_options = {
|
99
98
|
:format => '%y-%m-%d %H:%M',
|
100
99
|
:from => @from_opt,
|
101
100
|
:to => @to_opt,
|
102
|
-
|
101
|
+
:billed => @billed_resolved_opt,
|
103
102
|
}
|
104
103
|
@csv_filter_options = {
|
105
104
|
:format => '%F %T %z',
|
@@ -107,6 +106,14 @@ module TheFox
|
|
107
106
|
:to => @to_opt,
|
108
107
|
}
|
109
108
|
|
109
|
+
# Used by
|
110
|
+
# print_formatted_task_list
|
111
|
+
# print_formatted_track_list
|
112
|
+
@format_options = {
|
113
|
+
:format => @format_opt,
|
114
|
+
:billed => @billed_resolved_opt,
|
115
|
+
}
|
116
|
+
|
110
117
|
if @csv_opt
|
111
118
|
if @csv_opt == '-'
|
112
119
|
# OK
|
@@ -224,9 +231,8 @@ module TheFox
|
|
224
231
|
totals[:task_c],
|
225
232
|
task.begin_datetime_s(@filter_options),
|
226
233
|
task.end_datetime_s(@filter_options),
|
227
|
-
duration.
|
228
|
-
unbilled_duration.
|
229
|
-
# tracks_c,
|
234
|
+
duration.to_human_s,
|
235
|
+
unbilled_duration.to_human_s,
|
230
236
|
'%s %s' % [task.id_foreign_or_short, task.name(15)]
|
231
237
|
]
|
232
238
|
end
|
@@ -242,9 +248,8 @@ module TheFox
|
|
242
248
|
nil, # task_c
|
243
249
|
totals[:begin_datetime_s],
|
244
250
|
totals[:end_datetime_s],
|
245
|
-
totals[:duration].
|
246
|
-
totals[:unbilled_duration].
|
247
|
-
# totals[:tracks_c],
|
251
|
+
totals[:duration].to_human_s, # duration
|
252
|
+
totals[:unbilled_duration].to_human_s, # duration
|
248
253
|
'TOTAL', # task
|
249
254
|
]
|
250
255
|
|
@@ -256,9 +261,8 @@ module TheFox
|
|
256
261
|
end
|
257
262
|
|
258
263
|
def print_formatted_task_list
|
259
|
-
puts 'print_formatted_task_list'
|
260
264
|
filtered_tasks.each do |task|
|
261
|
-
puts task.formatted(@
|
265
|
+
puts task.formatted(@format_options)
|
262
266
|
end
|
263
267
|
end
|
264
268
|
|
@@ -321,7 +325,7 @@ module TheFox
|
|
321
325
|
totals[:tracks_c],
|
322
326
|
track.begin_datetime_s(@filter_options),
|
323
327
|
track.end_datetime_s(@filter_options),
|
324
|
-
duration.
|
328
|
+
duration.to_human_s,
|
325
329
|
'%s' % [task.id_foreign_or_short],
|
326
330
|
'%s %s' % [track.short_id, track.title(15)],
|
327
331
|
]
|
@@ -338,7 +342,7 @@ module TheFox
|
|
338
342
|
nil, # task_c
|
339
343
|
totals[:begin_datetime_s],
|
340
344
|
totals[:end_datetime_s],
|
341
|
-
totals[:duration].
|
345
|
+
totals[:duration].to_human_s, # duration
|
342
346
|
'TOTAL', # task
|
343
347
|
nil, # track
|
344
348
|
]
|
@@ -351,9 +355,8 @@ module TheFox
|
|
351
355
|
end
|
352
356
|
|
353
357
|
def print_formatted_track_list
|
354
|
-
puts 'print_formatted_track_list'
|
355
358
|
@timr.tracks(@filter_options).each do |track_id, track|
|
356
|
-
puts track.formatted(@
|
359
|
+
puts track.formatted(@format_options)
|
357
360
|
end
|
358
361
|
end
|
359
362
|
|
@@ -478,7 +481,7 @@ module TheFox
|
|
478
481
|
totals[:end_datetime] = edt
|
479
482
|
end
|
480
483
|
|
481
|
-
|
484
|
+
row = [
|
482
485
|
totals[:row_c],
|
483
486
|
|
484
487
|
task.id,
|
@@ -488,21 +491,36 @@ module TheFox
|
|
488
491
|
task.begin_datetime_s(@csv_filter_options),
|
489
492
|
task.end_datetime_s(@csv_filter_options),
|
490
493
|
|
491
|
-
duration
|
492
|
-
duration
|
493
|
-
estimation ? estimation.to_human : '---',
|
494
|
-
estimation ? estimation.to_i : 0,
|
495
|
-
remaining_time ? remaining_time.to_human : '---',
|
496
|
-
remaining_time ? remaining_time.to_i : 0,
|
497
|
-
billed_duration ? billed_duration.to_human : '---',
|
498
|
-
billed_duration ? billed_duration.to_i : 0,
|
499
|
-
unbilled_duration ? unbilled_duration.to_human : '---',
|
500
|
-
unbilled_duration ? unbilled_duration.to_i : 0,
|
501
|
-
|
502
|
-
tracks_c,
|
503
|
-
billed_tracks_c,
|
504
|
-
unbilled_tracks_c,
|
494
|
+
duration.to_human_s,
|
495
|
+
duration.to_i,
|
505
496
|
]
|
497
|
+
|
498
|
+
if estimation
|
499
|
+
row << estimation.to_human_s
|
500
|
+
row << estimation.to_i
|
501
|
+
else
|
502
|
+
row << '---'
|
503
|
+
row << 0
|
504
|
+
end
|
505
|
+
|
506
|
+
if remaining_time
|
507
|
+
row << remaining_time.to_human_s
|
508
|
+
row << remaining_time.to_i
|
509
|
+
else
|
510
|
+
row << '---'
|
511
|
+
row << 0
|
512
|
+
end
|
513
|
+
|
514
|
+
row << billed_duration.to_human_s
|
515
|
+
row << billed_duration.to_i
|
516
|
+
row << unbilled_duration.to_human_s
|
517
|
+
row << unbilled_duration.to_i
|
518
|
+
|
519
|
+
row << tracks_c
|
520
|
+
row << billed_tracks_c
|
521
|
+
row << unbilled_tracks_c
|
522
|
+
|
523
|
+
csv << row
|
506
524
|
end
|
507
525
|
|
508
526
|
totals[:begin_datetime_s] = totals[:begin_datetime] ? totals[:begin_datetime].localtime.strftime(@csv_filter_options[:format]) : '---'
|
@@ -520,18 +538,23 @@ module TheFox
|
|
520
538
|
totals[:begin_datetime_s],
|
521
539
|
totals[:end_datetime_s],
|
522
540
|
|
523
|
-
totals[:duration]
|
524
|
-
totals[:duration]
|
525
|
-
|
526
|
-
totals[:estimation]
|
527
|
-
totals[:
|
528
|
-
|
529
|
-
totals[:
|
530
|
-
totals[:
|
531
|
-
|
532
|
-
totals[:
|
541
|
+
totals[:duration].to_human_s,
|
542
|
+
totals[:duration].to_i,
|
543
|
+
|
544
|
+
totals[:estimation].to_human_s,
|
545
|
+
totals[:estimation].to_i,
|
546
|
+
|
547
|
+
totals[:remaining_time].to_human_s,
|
548
|
+
totals[:remaining_time].to_i,
|
549
|
+
|
550
|
+
totals[:billed_duration].to_human_s,
|
551
|
+
totals[:billed_duration].to_i,
|
552
|
+
|
553
|
+
totals[:unbilled_duration].to_human_s,
|
554
|
+
totals[:unbilled_duration].to_i,
|
533
555
|
|
534
556
|
totals[:tracks_c],
|
557
|
+
|
535
558
|
totals[:billed_tracks_c],
|
536
559
|
totals[:unbilled_tracks_c],
|
537
560
|
]
|
@@ -625,7 +648,7 @@ module TheFox
|
|
625
648
|
totals[:end_datetime] = edt
|
626
649
|
end
|
627
650
|
|
628
|
-
|
651
|
+
row = [
|
629
652
|
totals[:row_c],
|
630
653
|
|
631
654
|
task.id,
|
@@ -637,15 +660,19 @@ module TheFox
|
|
637
660
|
track.begin_datetime_s(@csv_filter_options),
|
638
661
|
track.end_datetime_s(@csv_filter_options),
|
639
662
|
|
640
|
-
duration
|
641
|
-
duration
|
642
|
-
|
643
|
-
billed_duration
|
644
|
-
|
645
|
-
|
663
|
+
duration.to_human_s,
|
664
|
+
duration.to_i,
|
665
|
+
|
666
|
+
billed_duration.to_human_s,
|
667
|
+
billed_duration.to_i,
|
668
|
+
|
669
|
+
unbilled_duration.to_human_s,
|
670
|
+
unbilled_duration.to_i,
|
646
671
|
|
647
672
|
track.is_billed.to_i,
|
648
673
|
]
|
674
|
+
|
675
|
+
csv << row
|
649
676
|
end
|
650
677
|
|
651
678
|
totals[:begin_datetime_s] = totals[:begin_datetime] ? totals[:begin_datetime].localtime.strftime(@csv_filter_options[:format]) : '---'
|
@@ -653,7 +680,7 @@ module TheFox
|
|
653
680
|
totals[:end_datetime_s] = totals[:end_datetime] ? totals[:end_datetime].localtime.strftime(@csv_filter_options[:format]) : '---'
|
654
681
|
|
655
682
|
totals[:row_c] += 1
|
656
|
-
|
683
|
+
row = [
|
657
684
|
totals[:row_c],
|
658
685
|
'TOTAL',
|
659
686
|
|
@@ -666,14 +693,18 @@ module TheFox
|
|
666
693
|
totals[:begin_datetime_s],
|
667
694
|
totals[:end_datetime_s],
|
668
695
|
|
669
|
-
totals[:duration]
|
670
|
-
totals[:duration]
|
671
|
-
|
672
|
-
totals[:billed_duration]
|
673
|
-
totals[:
|
674
|
-
|
696
|
+
totals[:duration].to_human_s,
|
697
|
+
totals[:duration].to_i,
|
698
|
+
|
699
|
+
totals[:billed_duration].to_human_s,
|
700
|
+
totals[:billed_duration].to_i,
|
701
|
+
|
702
|
+
totals[:unbilled_duration].to_human_s,
|
703
|
+
totals[:unbilled_duration].to_i,
|
675
704
|
]
|
676
705
|
|
706
|
+
csv << row
|
707
|
+
|
677
708
|
csv.close
|
678
709
|
end
|
679
710
|
|
@@ -688,7 +719,8 @@ module TheFox
|
|
688
719
|
def help
|
689
720
|
puts 'usage: timr report [-d|--day <date>] [-m|--month <[YYYY-]MM>]'
|
690
721
|
puts ' [-y|--year [<YYYY>]] [-a|--all] [--tasks|--tracks]'
|
691
|
-
puts ' [--
|
722
|
+
puts ' [--billed|--unbilled]'
|
723
|
+
puts ' [--csv <path>] [--force] [--format <str>]'
|
692
724
|
puts ' or: timr report [-h|--help]'
|
693
725
|
puts
|
694
726
|
puts 'Options'
|
@@ -698,9 +730,9 @@ module TheFox
|
|
698
730
|
puts ' -a, --all All.'
|
699
731
|
puts ' --tasks Export Tasks (default)'
|
700
732
|
puts ' --tracks Export Tracks'
|
701
|
-
|
702
|
-
|
703
|
-
puts ' --format
|
733
|
+
puts ' --billed Filter only Tasks/Tracks which are billed.'
|
734
|
+
puts ' --unbilled Filter only Tasks/Tracks which are not billed.'
|
735
|
+
puts ' --format <str> Format Tasks and Tracks output.'
|
704
736
|
puts " --csv <path> Export as CSV file. Use '--csv -' to use STDOUT."
|
705
737
|
puts " --force Force overwrite file."
|
706
738
|
puts
|
@@ -715,6 +747,8 @@ module TheFox
|
|
715
747
|
puts ' %fid Foreign ID'
|
716
748
|
puts ' %n Name'
|
717
749
|
puts ' %d Description'
|
750
|
+
puts ' %ds Duration Seconds'
|
751
|
+
puts ' %dh Duration Human Format'
|
718
752
|
puts
|
719
753
|
puts 'Track Format'
|
720
754
|
puts ' %id ID'
|
@@ -726,6 +760,10 @@ module TheFox
|
|
726
760
|
puts ' %edt End DateTime'
|
727
761
|
puts ' %ed End Date'
|
728
762
|
puts ' %et End Time'
|
763
|
+
puts ' %ds Duration Seconds'
|
764
|
+
puts ' %dh Duration Human Format'
|
765
|
+
puts ' %bi Billed Integer'
|
766
|
+
puts ' %bh Billed Human Format (YES, NO)'
|
729
767
|
puts
|
730
768
|
puts "Use '%T' prefix for each Task attribute for Track formatting."
|
731
769
|
puts "For example use '%Tid' to use the Task ID."
|