Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo-husky/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e

cargo fmt -- --check
cargo clippy -- -D warnings
4 changes: 4 additions & 0 deletions .cargo-husky/hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e

cargo nextest run
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check

clippy:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features -- -D warnings

test:
needs: [fmt, clippy]
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@nextest
- run: cargo nextest run --all-features
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.cache
/target
Cargo.lock

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.0] - 2025-11-28

### Added

- Windows support (named pipes, process management)
- Git hooks via cargo-husky (pre-commit: fmt/clippy, pre-push: nextest)

## [0.5.0] - 2025-01-23

### Added
Expand Down
13 changes: 12 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "daemon-cli"
version = "0.5.0"
version = "0.6.0"
edition = "2024"

[dependencies]
Expand All @@ -18,12 +18,23 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
parking_lot = "0.12"
terminal_size = "0.4"
supports-color = "3.0"
interprocess = { version = "2.2", features = ["tokio"] }

[target.'cfg(unix)'.dependencies]
nix = { version = "0.30.1", features = ["signal"] }

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61.2", features = [
"Win32_Foundation",
"Win32_System_Threading",
] }
widestring = "1.0"

[[example]]
name = "cli"
path = "examples/cli.rs"

[dev-dependencies]
tokio-test = "0.4"
rand = "0.8"
cargo-husky = { version = "1", default-features = false, features = ["user-hooks"] }
4 changes: 2 additions & 2 deletions examples/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ impl CommandHandler for CommandProcessor {
mut output: impl AsyncWrite + Send + Unpin,
cancel_token: CancellationToken,
) -> Result<i32> {
let parts: Vec<&str> = command.trim().split_whitespace().collect();
let parts: Vec<&str> = command.split_whitespace().collect();

match parts.get(0) {
match parts.first() {
Some(&"status") => {
output.write_all(b"Daemon ready for processing\n").await?;
Ok(0)
Expand Down
4 changes: 2 additions & 2 deletions examples/concurrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ impl CommandHandler for TaskQueueHandler {
});
});

let parts: Vec<&str> = command.trim().split_whitespace().collect();
let parts: Vec<&str> = command.split_whitespace().collect();

match parts.get(0) {
match parts.first() {
Some(&"add-task") => {
let task_description = parts[1..].join(" ");
if task_description.is_empty() {
Expand Down
Loading