#时间跟踪 #跟踪 #时间 #命令行界面 #API 绑定 #CLI

应用程序 toggl

使用 v9 API 的 Toggl Track 的非官方命令行界面

9 个不稳定版本 (3 个重大更改)

0.4.4 2024年5月27日
0.4.3 2024年5月24日
0.4.2 2023年12月22日
0.3.0 2023年8月30日
0.1.0 2019年5月15日

#63日期和时间

每月下载量

MIT 许可证

100KB
2.5K SLoC

toggl-cli

用 Rust 编写的 Toggl Track 的非官方 CLI,使用 v9 API

用法

构建二进制文件。

cargo build # or cargo build --release

安装二进制文件。

crates.io

cargo install toggl

从 Arch Linux aur

toggl-cli toggl-cli-bin

toggl-cli 可在 AUR 上使用

您可以使用您选择的 AUR 助手 安装它。

示例

$ yay -Sy toggl-cli

从源代码

cargo install --path .

这会将优化后的发布二进制文件放置在 ~/.cargo/bin/toggl。请确保将 ~/.cargo/bin 添加到您的 $PATH,这样您就可以在任何目录中运行二进制文件。

现在您可以使用 toggl 命令调用二进制文件。或者,您也可以直接使用 cargo run 运行命令。

cargo run [command]


# To list the last 3 time-entries
cargo run list -n 3

您需要运行的第一条命令是 auth,用于设置您的 Toggl API令牌

cargo run auth [API_TOKEN] # or toggl auth [API_TOKEN]

API令牌通过keyring crate安全地存储在操作系统的密钥链中。

命令

运行 help 命令以查看可用命令列表。

$ toggl help
toggl 0.4.4
Toggl command line app.

USAGE:
    toggl [FLAGS] [OPTIONS] [SUBCOMMAND]

FLAGS:
        --fzf        Use fzf instead of the default picker
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -C <directory>         Change directory before running the command
        --proxy <proxy>    Use custom proxy

SUBCOMMANDS:
    auth        Authenticate with the Toggl API. Find your API token at https://track.toggl.com/profile#api-token
    config      Manage auto-tracking configuration
    continue
    current
    help        Prints this message or the help of the given subcommand(s)
    list
    logout      Clear stored credentials
    running
    start       Start a new time entry, call with no arguments to start in interactive mode
    stop

您也可以在特定的子命令上运行 help 命令。

$ toggl help start
toggl-start 0.4.4
Start a new time entry, call with no arguments to start in interactive mode

USAGE:
    toggl start [FLAGS] [OPTIONS] [description]

FLAGS:
    -b, --billable
    -h, --help           Prints help information
    -i, --interactive
    -V, --version        Prints version information

OPTIONS:
    -p, --project <project>    Exact name of the project you want the time entry to be associated with

ARGS:
    <description>    Description of the time entry

测试

要运行单元测试

cargo test

代码审查

常见代码审查工具

cargo fmt # Formatting the code to a unified style.

cargo clippy --fix # To automatically fix common mistakes.

CI还会为所有pull-requests运行代码审查命令。更多详情请见pull_request.yml

发布

要创建新版本,首先增加包的版本号。我们有一个方便的脚本在pkg/autodoc.rs中。不带参数运行它,将增加当前的补丁版本,在Cargo.tomlCargo.lock文件中。它还会更新本README中的帮助文档以匹配当前命令版本。提交并推送更新的更改,新版本将显示在发布页面下。


Watercooler Studio构建

依赖

~16–30MB
~483K SLoC