drademann / haora

CLI application for time tracking of working hours.
Apache License 2.0
1 stars 0 forks source link
cli go golang

Haora

A CLI application programmed with Go to track working times.

Go Build & Test

Description

With different commands, the CLI allows recording working times. One record (task) consists of

To end the work for a day a finish timestamp can be set, see the finish command. The list command shows the tasks of a day, optionally the sums per tag. With the --week option it shows all start and end times of a week.

Global Flags

--date -d

Set the date any following command will work with. If this flag is not specified, Haora will assume today. Different date formats are allowed:

Format Description Example
DD.MM.YYYY
DD.MM.YY
a specific date 9.3.2024
24.12.2023
DD.MM.
DD.MM
a date within the current year 9.3.
24.12
DD.
DD
a day within the current month and year 9.
24
WW the previous weekday
(selects the first date prior to today
with the given weekday)
mo, tu, we, th, fr, sa, su
YD yesterday y, yd, ye, yes, yesterday

Commands

Commands that take a timestamp as argument accept different formats:

Format Description Example
HH:MM timestamp with semicolon 10:30
9:42
HHMM without semicolon 1030
942

list

The list command lists previously recorded tasks.

$ haora list

Flags

--tags [day|month]

List the working hours per tag. The totals collect the tags of either a day or a month based on the given global date.

--week

List the start and end timestamps of a week. The week always starts at the previous monday compared to the given date.

add

The add command adds another task to the selected day. The simplest way is to use the command without any flag:

$ haora add 10:00 haora some programming

This will add a task

Using a timestamp that is already set on another task will update that task.

Flags

--start 10:00 or -s 10:00

To explicitly set a starting timestamp for the task.

--tags "haora,go"

Specific flag to set multiple tags.

pause

The pause command adds a pause to the selected day.

$ haora pause 12:00 Lunch

No tags are used for a pause, but a text may be set.

Flags

--start 12:00 or -s 12:00

To explicitly set a starting timestamp for the pause.

remove

Removes a task of a day. The task is identified by its starting timestamp, like

$ haora remove 10:00

It may also remove a pause, which is nothing less than a task marked as pause.

finish

Closes the day and sets a finish timestamp.

$ haora finish 17:00

Flags

--end 17:00 or -e 17:00

To explicitly set a finish time.

--remove

To remove an already set finish time.

version

Print the current version of Haora.

Configuration

Haora uses a configuration file read from ~/.haora/config.yaml. This JSON file has the following format:

times:
  durationPerWeek: "32h"
  daysPerWeek: 5

When the file is not present, the default values are used.

Duration per Week

Sets the desired number of working hours per week. Minutes may be added as well, like "38h 30m".

Default: "40h"

Days per Week

Sets the number of workdays in a week. This determines the desired number of working hours per day.

Default: 5

Build

To get the latest greatest version of haora, it may be built from scratch:

Checkout this repository, ensure you are on the main branch (the current production branch), have Go installed, and run

$ go install

It will install haora within your Go bin folder. That's it.