Skip to content

Commit e971e08

Browse files
Merge pull request #67 from dvklopfenstein/dev
Improved reports showing all running timers with brevity and rich info
2 parents 911e373 + ccd7b31 commit e971e08

File tree

10 files changed

+43
-13
lines changed

10 files changed

+43
-13
lines changed

.timetracker/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
start_*.txt

.timetracker/config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# TimeTracker project configuration file
2+
3+
project = "timetracker"
4+
5+
[csv]
6+
filename = "./timetracker_timetracker_$USER$.csv"

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Summary
44
* [**Unreleased**](#unreleased)
5+
* [**Release 2025-07-15 v0.8a4**](#release-2025-07-15-v08a4) Made options and output more concise
56
* **Release 2025-07-04 v0.8.3** Clean README
67
* [**Release 2025-06-28 v0.8a1**](#release-2025-06-28-v08a1) Added the command `trk running`
78
* [**Release 2025-06-28 v0.8a0**](#release-2025-06-28-v08a0) Documentation; minor speed; simplify stop defaults
@@ -34,9 +35,13 @@
3435
# Details
3536

3637
## Unreleased
38+
39+
## Release 2025-07-15 v0.8a4
40+
* CHANGED `trk running` output to be more concise
3741
* ADDED short option '-d' to original long option '--csvdir' in command, 'trk init'
3842
* ADDED new script, `timecalc` that takes two of: starttime, stoptime, or timedelta and
3943
returns the missing datetime or timedelta
44+
* ADDED documentation for `trk running`
4045

4146
## Release 2025-06-28 v0.8a1 - 2025-07-04 v0.8a3
4247
* CHANGED: README cleanup and added links

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ plain text [CSV](https://www.datarisy.com/blog/understanding-csv-files-use-cases
3838
* **Freedom**: Libre Software (aka open-source)
3939
* **Simple**: Quick to set up
4040
* **Privacy**: Own your data
41-
* **Anti-stalking**: NO invasive tracking ever of keystrokes, browser activity, mouse-clicks, etc.,
41+
* **Anti-stalking**: No invasive tracking ever of keystrokes, browser activity, mouse-clicks, etc.,
4242
as is done by multitudinous other timetracking apps
4343
* **Human-and-machine-readable**: ASCII data stored in CSV (comma-separated values) [plaintext](http://www.markwk.com/plain-text-life.html) files:
4444
* Ready for [pandas](https://pandas.pydata.org/), the Python Data Analysis Library for tabular data

makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ clean:
113113
rm -f *.docx
114114
rm -f .timetracker_starttime
115115
rm -f *.cfg
116+
rm -f timetrials_datatime.csv
116117

117118
clobber:
118119
make clean

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77
[project]
88
name = "timetracker-csv"
99
description = "Pandas-friendly time tracking from the CLI"
10-
version = '0.8.3'
10+
version = '0.8.4'
1111
license = "AGPL-3.0-or-later"
1212
authors = [
1313
{name = 'DV Klopfenstein, PhD', email = 'dvklopfenstein@protonmail.com'},

timetracker/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
__copyright__ = 'Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved'
44
__author__ = 'DV Klopfenstein, PhD'
5-
__version__ = '0.8.3'
5+
__version__ = '0.8.4'
66

77
# Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved

timetracker/cmd/common.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ def _prtmsg_basic(startobj, dta, hms, force):
8888

8989
def _prt_started_n_running(startobj, dta, hms):
9090
"""Return a string detailing how long the timer has been running"""
91-
msg = startobj.str_elapsed_hms(
91+
msg = startobj.str_elapsed_ymdhms(
9292
hms,
93-
f'Timer started on {dta.strftime(FMTDT_H)} and running')
93+
(f'Timer started {dta.strftime(FMTDT_H)} {startobj.str_info()}\n'
94+
'Timer running'))
9495
print(msg)
9596

9697
# ---------------------------------------------------------
@@ -100,7 +101,7 @@ def prt_elapsed(startobj, pretxt='Timer running;'):
100101
if (dtstart := startobj.read_starttime()) is not None:
101102
if (hms := startobj.hms_from_startfile(dtstart)) is not None:
102103
msg = f'{pretxt} started {dtstart.strftime(FMTDT_H)}; running'
103-
print(startobj.str_elapsed_hms(hms, msg))
104+
print(startobj.str_elapsed_ymdhms(hms, msg))
104105
else:
105106
from timetracker.msgs import str_not_running
106107
print(str_not_running())

timetracker/cmd/running.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from timetracker.cfg.cfg import Cfg
88
from timetracker.cfg.doc_local import get_docproj
99
from timetracker.cmd.common import str_uninitialized
10-
from timetracker.consts import FMTDT_H
1110

1211

1312
def cli_run_running(fnamecfg, args):
@@ -33,9 +32,9 @@ def _show_running(cfg_glb, uname, verbose):
3332
(startobj := doc.get_startobj(uname)) is not None and \
3433
startobj.started():
3534
if (dta := startobj.read_starttime()):
36-
print(startobj.str_elapsed_hms(
37-
startobj.hms_from_startfile(dta),
38-
f'Timer started on {dta.strftime(FMTDT_H)} and running'))
35+
hms = startobj.hms_from_startfile(dta)
36+
# Began Tue 2025-07-15 11:56:17 AM -> H:M:S
37+
print(f'Began {startobj.str_started(dta)} -> {startobj.str_running(hms)}')
3938
if verbose:
4039
print(f' {dirname(dirname(pcfg))}\n')
4140
runcnt += 1

timetracker/starttime.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,26 @@ def hms_from_startfile(self, dtstart):
7272
"""Get the elapsed time starting from time in a starttime file"""
7373
return datetime.datetime.now() - dtstart if dtstart is not None else None
7474

75-
def str_elapsed_hms(self, hms, msg):
76-
"""Get a string describing the elapsed time"""
77-
return f"{msg} H:M:S {hms} for '{self.project}' ID={self.name}"
75+
def str_elapsed_ymdhms(self, hms, msg):
76+
"""Get a string describing the elapsed time: YYYY-MM-DD HH:MM:SS"""
77+
##return f"{msg} H:M:S {hms} for '{self.project}' ID={self.name}"
78+
return f"{msg} H:M:S {hms}"
79+
80+
def str_started(self, dta):
81+
"""Get a string describing the elapsed time: HH:MM:SS"""
82+
##return f"{msg} H:M:S {hms} for '{self.project}' ID={self.name}"
83+
return dta.strftime(consts.FMTDT_H)
84+
85+
def str_running(self, hms, rm_useconds=True):
86+
"""Get a string describing the elapsed time: HH:MM:SS"""
87+
##return f"{msg} H:M:S {hms} for '{self.project}' ID={self.name}"
88+
if rm_useconds:
89+
hms = hms - datetime.timedelta(microseconds=hms.microseconds)
90+
return f"H:M:S {hms} by {self.name} for {self.project}"
91+
92+
def str_info(self):
93+
"""Get a string with the project, username, and csv filename"""
94+
return f'on `{self.project}` by `{self.name}`'
7895

7996

8097
# Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved.

0 commit comments

Comments
 (0)