百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
H

hours

> 编程语言
开源

一个不设任何花哨功能的时间跟踪工具包,适用于命令行专家

346 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个不设任何花哨功能的时间跟踪工具包,适用于命令行专家

hours

hours is a no-frills time tracking toolkit for the command line.

It's designed for users who want basic time tracking for their tasks/projects right in the terminal. With a simple and minimalistic UI, almost everything in hours can be achieved with one or two keypresses. It can also generate plaintext reports, summary statistics, and logs based on time tracked.

Link to Video

Motivation

For a while, I've been wanting to keep track of time I spend on side projects and other non-day-job activities. I also wanted to be able to generate plain text reports to get an overview of time allocation. All of this needed to be done via a fast command line tool that prioritised ease of use over fancy-but-ultimately-not-so-useful features. I couldn't find a tool that precisely fit these needs, so I decided to build one for myself.

Install

Pre-built binaries

Download a pre-built binary from the latest release. See Verifying release artifacts for instructions on verifying your download.

Install from source

You can also install from source using the go toolchain:

bash
go install github.com/dhth/hours@latest

⚡️ Usage

Newbie tip: If you want to see how hours works without having to track time, you can have it generate dummy data for you. See here for more details.

TUI

Open the TUI by simply running hours. The TUI lets you do the following:

  • create/update tasks
  • start/stop tracking time on a task
  • add manual task log entries
  • edit task logs
  • view task log details
  • deactivate/activate a task
  • view historical task log entries

Besides a TUI, hours also offers reports, statistics, and logs based on the time tracking you do. These can be viewed using the subcommands report, stats, and log respectively.

Reports

bash
hours report [flags] [arg]

Output a report based on task log entries.

Reports show time spent on tasks per day in the time period you specify. These can also be aggregated (using -a) to consolidate all task entries and show the cumulative time spent on each task per day.

Accepts an argument, which can be one of the following:

today      for today's report
yest       for yesterday's report
3d         for a report on the last 3 days (default)
week       for a report on the current week
date       for a report for a specific date (eg. "2024/06/08")
range      for a report for a date range (eg. "2024/06/08...2024/06/12", "2024/06/08...today", "2024/06/08..."; shouldn't be greater than 7 days)

Note: If a task log continues past midnight in your local timezone, it will be reported on the day it ends.

Reports can also be viewed via an interactive interface using the --interactive/-i flag.

Log

bash
hours log [flags] [arg]

Output task log entries.

Accepts an argument, which can be one of the following:

today      for log entries from today (default)
yest       for log entries from yesterday
3d         for log entries from the last 3 days
week       for log entries from the current week
date       for log entries from a specific date (eg. "2024/06/08")
range      for log entries for a date range (eg. "2024/06/08...2024/06/12", "2024/06/08...today", "2024/06/08...")

Note: If a task log continues past midnight in your local timezone, it'll appear in the log for the day it ends.

Logs can also be viewed via an interactive interface using the --interactive/-i flag.

Statistics

bash
hours stats [flag] [arg]

Output statistics for tracked time.

Accepts an argument, which can be one of the following:

today      show stats for today
yest       show stats for yesterday
3d         show stats for the last 3 days (default)
week       show stats for the current week
date       show stats for a specific date (eg. "2024/06/08")
range      show stats for a date range (eg. "2024/06/08...2024/06/12", "2024/06/08...today", "2024/06/08...")
all        show stats for all log entries

Note: If a task log continues past midnight in your local timezone, it'll be considered in the stats for the day it ends.

Stats can also be viewed via an interactive interface using the --interactive/-i flag.

Active Task

hours can show you the task being actively tracked using the active subcommand. This subcommand supports the following placeholders using the --template/-t flag:

{{task}}:  for the task summary
{{time}}:  for the time spent so far on the active log entry

Tip: This can be used to display the active task in tmux's (or similar terminal multiplexers) status line using:

set -g status-right "#(hours active -t ' {{task}} ({{time}}) ')".

Generate Dummy Data

You can have hours generate dummy data for you, so you can play around with it, and see if its approach of showing reports/logs/stats works for you. You can do so using the gen subcommand.

bash
hours gen --dbpath=/var/tmp/throwaway.db

Custom Themes

hours supports custom themes for its user interface (for the TUI and the output of the logs, report, and stats commands. New themes can be added using hours themes add, which will create a JSON file in hours' config directory. You can then tweak this file as per your liking.

A sample theme config looks like the following. Colors codes can be provided in ANSI 16, ANSI 256, or HEX formats. You can choose to provide only the attributes you want to change.

…

You can view configured themes using hours themes list.

Running hours with the --theme flag will load up that theme. Alternatively, you can set $HOURS_THEME to the theme name so you don't have to pass the flag every time.

Here's a sampling of custom themes in action.

Theme Preview
Solarized Dark
Monokai
Nord
Dracula
Gruvbox
Catppuccin
Tokyonight

TUI Reference Manual

hours has 6 views:

  • Tasks List View Shows active tasks
  • Task Management View Shows a form to create/update tasks
  • Task Logs List View Shows your task logs
  • Task Log Details View Shows details for a task log
  • Inactive Tasks List View Shows inactive tasks
  • Task Log Entry View Shows a form to save/update a task log entry
  • Help View

Keyboard Shortcuts

General

Shortcut Action
1 Switch to Tasks List View
2 Switch to Task Logs List View
3 Switch to Inactive Tasks List View
`` Go to next view/form entry
`` Go to previous view/form entry
q/`` Go back or quit
`` Quit immediately
? Show help view

General List Controls

Shortcut Action
k/`` Move cursor up
j/`` Move cursor down
h/`` Go to previous page
l/`` Go to next page
`` Refresh list

Task List View

Shortcut Action
a Add a task
u Update task details
s Start/stop recording time on a task; stopping will open up the "Task Log Entry View"
S Quick switch recording; will save a task log entry for the currently active task, and start recording time for another
f Finish the currently active task log without comment
`` Edit the currently active task log/Add a new manual task log entry
`` Discard currently active recording
`` Go to currently tracked item
`` Deactivate task

Task Logs List View

Note: ~ at the end of a task log comment indicates that it has more lines that are not visible in the list view

Shortcut Action
d Show task log details
``/u Update task log entry
`` Delete task log entry

Task Log Details View

Shortcut Action
h Go to previous entry
l Go to next entry

Inactive Task List View

Shortcut Action
`` Activate task

Task Log Entry View

Shortcut Action
enter/`` Save entered details for the task log
k Move timestamp backwards by one minute
j Move timestamp forwards by one minute
K Move timestamp backwards by five minutes
J Move timestamp forwards by five minutes
h Move timestamp backwards by a day
l Move timestamp forwards by a day

Verifying release artifacts

Each release includes checksums for all artifacts. The checksum file is signed using cosign.

Replace x.y.z below with the release version you want to verify.

  1. Download the following files from the release:

    • hours_x.y.z_checksums.txt
    • hours_x.y.z_checksums.txt.pem
    • hours_x.y.z_checksums.txt.sig
  2. Verify the checksum file's signature:

    bash
    cosign verify-blob hours_x.y.z_checksums.txt \
       --certificate hours_x.y.z_checksums.txt.pem \
       --signature hours_x.y.z_checksums.txt.sig \
       --certificate-identity-regexp 'https://github\.com/dhth/hours/\.github/workflows/.+' \
       --certificate-oidc-issuer "https://token.actions.githubusercontent.com"
  3. Download the archive for your platform and validate its checksum. For example, for Linux x86-64:

    bash
    curl -sSLO https://github.com/dhth/hours/releases/download/vx.y.z/hours_x.y.z_linux_amd64.tar.gz
    sha256sum --ignore-missing -c hours_x.y.z_checksums.txt
  4. Once both checks pass, extract the archive:

    bash
    tar -xzf hours_x.y.z_linux_amd64.tar.gz
    ./hours -h
    # profit!

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gotime-trackertime-trackingtui

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言