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

habitctl

> 编程语言
开源

这是一个最简单的命令行工具,可用于跟踪和分析您的习惯。

400 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

这是一个最简单的命令行工具,可用于跟踪和分析您的习惯。

habitctl

habitctl is a minimalist command line tool you can use to track and examine your habits. It was born when I grew frustrated with tracking my habits in plain text files using hand-drawn ASCII tables. habitctl tries to get the job done and then get out of your way.

Installation

habitctl is written in the Rust programming language, so you'll need a working, up-to-date Rust installation. You'll probably want to run these commands:

$ curl -f https://sh.rustup.rs > rust.sh
$ sh rust.sh
$ source ~/.cargo/env

Then, compiling habitctl is as easy as this:

$ git clone https://github.com/blinry/habitctl
$ cd habitctl
$ cargo build --release

This will create the binary target/release/habitctl, which you can add to your $PATH. Additionally, I like to set up an alias called h.

Usage

When you run habitctl for the first time, it will set up the required files:

$ h
Welcome to habitctl!

Created /home/seb/.habitctl/habits. This file will list your currently tracked habits.
Created /home/seb/.habitctl/log. This file will contain your habit log.

You don't have any habits set up!
Run `habitctl edith` to modify the habit list using your default $EDITOR.
Then, run `habitctl`! Happy tracking!

Run h edith and change the content of the habits file, for example like this:

# The numbers specifies how often you want to do a habit:
# 1 means daily, 7 means weekly, 0 means you're just tracking the habit. Some examples:

1 Meditated
7 Cleaned the apartment
0 Had a headache
1 Used habitctl

Here are some more ideas of what to track:

  • got up at a certain time
  • used a spaced repetition software like Anki
  • took a multivitamin
  • cleared my email inbox
  • answered to all texts
  • visited and read all Slack workspaces
  • practiced a language
  • self reflection/used a diary
  • autogenic training
  • published something on my blog/homepage
  • worked on a project
  • did the dishes
  • tidied the apartment
  • closed all browser tabs
  • tracked caloric intake
  • happy
  • flow
  • relaxed
  • coffee intake
  • left my comfort zone
  • thanked someone

Then, simply run h regularly, specify whether or not you did the habit (or needed to skip the habit for some reason - eg. could not clean apartment because you were away for week), and get pretty graphs!

$ h
2018-09-15+02:00:
                Meditated ━       ━ ━  ━━         ━    ━   ━ ━   ━━━━━━━━━━━   ━ ━   ━[y/n/s/⏎] y
    Cleaned the apartment ━──────                 ━──────           ━──────    •······[y/n/s/⏎] n
           Had a headache             ━  ━     ━━                  ━━   ━   ━━        [y/n/s/⏎] n
            Used habitctl    ━ ━━━ ━  ━━━   ━ ━ ━       ━ ━ ━  ━ ━ ━━ ━ ━ ━━━━   ━    [y/n/s/⏎] y
2018-09-16+02:00:
                Meditated        ━ ━  ━━         ━    ━   ━ ━   ━━━━━━━━━━━   ━ ━   ━ [y/n/s/⏎] y
    Cleaned the apartment ──────                 ━──────           ━──────    •······ [y/n/s/⏎] n
           Had a headache            ━  ━     ━━                  ━━   ━   ━━         [y/n/s/⏎] n
            Used habitctl   ━ ━━━ ━  ━━━   ━ ━ ━       ━ ━ ━  ━ ━ ━━ ━ ━ ━━━━   ━    ━[y/n/s/⏎] y

(Some weeks later)

$ h log
                          ▄▃▃▄▄▃▄▆▆▆▅▆▆▇▆▄▃▄▆▃▆▃▆▂▅▄▃▄▅▆▅▃▃▃▆▂▄▅▄▅▅▅▆▄▄▆▇▆▅▅▄▃▅▆▄▆▃▃▂▅▆
                Meditated ━       ━ ━  ━━         ━    ━   ━ ━   ━━━━━━━━━━━   ━ ━   ━━
    Cleaned the apartment ━──────                 ━──────           ━──────    •······        
           Had a headache             ━  ━     ━━                  ━━   ━   ━━         
            Used habitctl    ━ ━━━ ━  ━━━   ━ ━ ━       ━ ━ ━  ━ ━ ━━ ━ ━ ━━━━   ━    ━

                                         ... some habits omitted ...

Yesterday's score: 73.3%

The score specifies how many of the due habits you did that day and removes any you may have skipped from the calculation. The sparkline at the top give a graphical representation of the score. The thick lines in the graph say that you did the habit, the thin lines say that that it was okay that you didn't to it. A thick dot implies you had to skip or were unable to exercise a habit for whatever good reason, and a thin dot indicates the period for which a skip would normally be in effect (in the example above, we are suggesting you could not clean your apartment because you were on a business trip when you'd normally clean it and can thus excuse yourself.).

Also, on the day, if a habit chain is in danger of breaking because it's the last day you can do it before the consistency graph would have a gap in it, habitctl will give you a warning by turning the " " symbol you'd see on the day into an "!".

Enter h help if you're lost:

$ h help
USAGE:
    habitctl [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    ask      Ask for status of all habits for a day
    edit     Edit habit log file
    edith    Edit list of current habits
    help     Prints this message or the help of the given subcommand(s)
    log      Print habit log
    todo     Print unresolved tasks for today

License: GPLv2+

habitctl is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Issues· 17 开放

查看全部 Issues在 GitHub 打开

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

> 标签

Rustcommandhabitlineminimalist

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

> 工具信息

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

> 相关工具

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