Skip to content

Latest commit

 

History

History
75 lines (60 loc) · 2.7 KB

File metadata and controls

75 lines (60 loc) · 2.7 KB

clock

Codacy Badge

Track your working hours on the command line

Install

Available as a bpkg package.

bpkg install -g lordvlad/clock

Because getting sudo working can be a bitch:

sudo -E env "PATH=$PATH" bpkg install -g lordvlad/clock

Usage

clock <command> [<task>] [<options>]

Commands

  • clock help show the help
  • clock in clock in, will clock out any running task
  • clock out clock out
  • clock log show all log entries, or log entries for <task>
  • clock list show sums for all tasks
  • clock completion print the completion script

Task

If no task is specified, the current working directory will be used as task specifier.

Options

  • -m|--message record additional message when clocking in/out
  • -f|--file where to save the clocks, defaults to $HOME/.clock
  • --by-task sort log entries by task for clock log
  • --gt=DATE with clock log, show only entries after DATE, with clock list sum up only entries after DATE. DATE can be any string that unix' date understands
  • --lt=DATE with clock log, show only entries before DATE, with clock list sum up only entries before DATE. DATE can be any string that unix' date understands

Environment Variables

  • CLOCK_FILE where to save the clocks, defaults to $HOME/.clock. If it starts with GIT_ROOT, the path will be resolved relative to the closest parent directory containing a .git folder. Missing directories will be created automatically. If GIT_ROOT is used but no git repository is found, clock will exit with an error.

Example:

export CLOCK_FILE=GIT_ROOT/docs/worklog
clock in  # Uses ./docs/worklog relative to the git repository root

Examples

$ mkdir -p tasks/{work,sleep}
$ clock in tasks/work
> clocked in /home/lordvlad/tasks/work
$ clock in tasks/sleep
> clocked out /home/lordvlad/tasks/work
> clocked in /home/lordvlad/tasks/sleep
$ clock out
> clocked out /home/lordvlad/tasks/sleep
$ clock log
> Tue 21 Apr 2015 06:31:24 PM UTC 00:01:23        /home/lordvlad/tasks/work
> Tue 21 Apr 2015 06:32:47 PM UTC 00:00:04        /home/lordvlad/tasks/sleep
$ clock list
> 00:00:04        /home/lordvlad/tasks/sleep
> 00:01:23        /home/lordvlad/tasks/work