7 个版本

0.10.5 2024年1月22日
0.10.3 2023年12月7日
0.10.1 2023年7月19日
0.9.2 2023年7月6日

#38财务

每月 42 次下载

AGPL-3.0 或更新版

105KB
2K SLoC

punchcard

一个简单的程序,用于跟踪工作时间。

周报表格 颜色可以通过 report 命令的参数进行自定义。强烈建议安装补全,因为有很多选项。

安装

默认情况下,punchcard 需要 nightly 来支持 SIMD。必须使用在 工具链文件 中定义的 nightly 版本编译。

# on stable Rust
cargo install punchcard --no-default-features --features stable

# on nightly Rust
cargo install punchcard

如果你使用 stable Rust,请使用 --no-default-features --features stable 编译。稳定构建的 MSRV 是 1.71.1。由于此程序主要针对 nightly,因此 MSRV 可以随时更改,因此没有 MSRV 策略。

补全

使用 punchcard completions <your shell> 打印补全文件,并将其管道传输到适合你 shell 的文件夹。

开发/调试构建

cargo run --no-default-features --features debug -- <args>
# or use the helper script which does exactly this:
./dev.sh -- <args>

用法

$ punchcard --help
A CLI tool for tracking work-from-home hours.

Usage: punchcard [OPTIONS] <COMMAND>

Commands:
  in             Clock in
  out            Clock out
  toggle         Clock either in or out
  status         Check the current status
  report         Interpret the times and generate a report
  completions    Generate completions for the given shell
  generate-data  Generate test data
  help           Print this message or the help of the given subcommand(s)

Options:
  -d, --data-folder <DATA_FOLDER>  [env: PUNCHCARD_DATA_FOLDER=.] [default: /home/campbell/.local/share/punchcard]
  -t, --timezone <TIMEZONE>        [env: PUNCHCARD_TIMEZONE=] [default: America/Los_Angeles]
  -h, --help                       Print help
  -V, --version                    Print version

注意:只有启用 generate_test_data 功能标志时,generate-data 子命令才可用。
此标志由 debug 功能标志启用,但也可以在发布构建中启用。

当使用 inouttogglestatus 子命令时,可以使用 -o 选项指定从当前时间的偏移量。

一些有效的输入示例

  • "in 1h 30m" -> 向当前时间添加 1 小时 30 分钟
  • "1h 30m" -> 向当前时间添加 1 小时 30 分钟
  • "1h 30m ago" -> 从当前时间减去 1 小时 30 分钟

前缀 in 是可选的;默认情况下,偏移量将添加到当前时间。

偏移量由 humantime 包进行解析。它接受多种格式。后缀不必是单个字母,但必须由空格分隔。例如,您可以使用 1hours1hour1hr1h 来指定 1 小时。

有关所有后缀的列表,请参阅 humantime 包的文档

https://docs.rs/humantime/latest/humantime/fn.parse_duration.html

屏幕截图

打卡/签退

clocking in and out

状态检查

clock status command

报告

使用上述时钟条目

每周(默认)

weekly report table

每日

daily report table

使用生成的测试数据

每周(默认)

weekly report table with test data

每日

daily report table with test data

依赖项

~35–66MB
~1M SLoC