This is a Rust CLI project (toggl-cli) — an unofficial CLI for Toggl Track time-tracking service.
| Task | Command |
|---|---|
| Build | cargo build |
| Test | cargo test |
| Lint (format) | cargo fmt --check |
| Lint (clippy) | cargo clippy |
| Run | cargo run -- <subcommand> |
- System dependencies required:
libdbus-1-dev,libssl-dev, andpkg-configmust be installed on Linux before building. These are needed by thekeyringandopenssl-syscrates respectively. - Rust toolchain: The project uses
rust-toolchain.tomlto pin the stable channel. Rustup will automatically select the correct toolchain. - Runtime authentication: Most CLI commands require a Toggl API token. Set via
toggl auth <TOKEN>or theTOGGL_API_TOKENenvironment variable. Without a token, commands likelist,start,stopwill print a message asking you to authenticate first. - No services to run: This is a standalone CLI binary with no databases, containers, or background services. Just build and run.
- openssl deprecation warning: The current
openssl v0.10.48dependency produces a future-incompatibility warning during build. This is cosmetic and does not affect functionality. - Mock trait for testing:
ApiClienttrait usesmockall::automockfor unit tests. When adding new methods to the trait, the mock is auto-generated, but all test files that constructUserstructs must include all fields (including optional ones added later). - Code style for new commands: Follow the existing pattern — each command gets its own file under
src/commands/, a struct withpub async fn execute(...), and must be registered insrc/commands/mod.rs,src/arguments.rs, andsrc/main.rs(routing). - Command structure: Commands use a kubectl-style
verb nounpattern. Grouped verbs (create,delete,edit,rename) have sub-enums (CreateEntity,DeleteEntity,EditEntity,RenameEntity) insrc/arguments.rs. Standalone commands (start,stop,list, etc.) remain as direct variants ofCommand.