diff --git a/Cargo.toml b/Cargo.toml index 412fba3..0c7f2c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,13 +3,37 @@ name = "native-diff" version = "0.1.0" edition = "2024" rust-version = "1.88" -description = "A terminal-native, read-only diff viewer" +description = "Fast terminal diff viewer and embeddable Rust diff engine" license = "Apache-2.0" +repository = "https://github.com/plannotator/diffs-rs" +readme = "README.md" +keywords = ["diff", "patch", "terminal", "tui", "ratatui"] +categories = ["command-line-utilities", "development-tools", "text-processing"] +# Publishing stays off until the crate no longer needs the [patch.crates-io] +# overrides below. crates.io ignores [patch], so a published build would +# silently use unpatched upstream syntect, fancy-regex and libgit2-sys. publish = false +# Ship only what the library and binary need to build, plus the docs a reader +# of the crate needs. Tests, fixtures, tools, reports and vendor/ stay in Git. +include = [ + "/src/**/*.rs", + "/assets/pierre/**", + "/examples/embedded_viewer.rs", + "/Cargo.toml", + "/Cargo.lock", + "/README.md", + "/EMBEDDING.md", + "/LICENSE", + "/NOTICE.md", +] [features] -default = ["clipboard"] +default = ["clipboard", "dev-tty"] clipboard = ["dep:arboard"] +# Read keyboard input from /dev/tty, so the standalone viewer works when the +# patch arrives on stdin. Embedding hosts that own their own input can turn +# this off with `default-features = false`. +dev-tty = ["crossterm/use-dev-tty"] delivery-trace = ["syntect/syntax-timing"] regex-census = ["syntect/regex-census"] owner-census = ["regex-census", "syntect/owner-census"] @@ -22,9 +46,9 @@ libgit2-sys = { path = "vendor/libgit2-sys" } [dependencies] anyhow = "1.0" clap = { version = "4.6", features = ["derive"] } -crossterm = { version = "0.29", features = ["use-dev-tty"] } +crossterm = "0.29" git2 = { version = "0.21", default-features = false, features = ["vendored-libgit2"] } -hashbrown = { version = "=0.16.1", default-features = false } +hashbrown = { version = "0.16.1", default-features = false } libc = "0.2" memchr = "2.8" nix = { version = "0.28", default-features = false, features = ["fs", "poll"] } @@ -41,7 +65,7 @@ unicode-segmentation = "1.13" unicode-width = "0.2" [target.'cfg(target_os = "macos")'.dependencies] -arboard = { version = "=3.6.1", default-features = false, optional = true } +arboard = { version = "3.6.1", default-features = false, optional = true } [dev-dependencies] fancy-regex = "0.16.2" diff --git a/EMBEDDING.md b/EMBEDDING.md index 50fc15e..422c2d0 100644 --- a/EMBEDDING.md +++ b/EMBEDDING.md @@ -29,6 +29,8 @@ The patches provide required syntax-engine behavior and the corrected local Git Do not substitute registry or system versions to make dependency resolution succeed. Keep the host's generated lockfile and use `--locked` for subsequent builds. Diagnostic crate features are not required for embedding. +The default `dev-tty` feature makes Crossterm read keyboard input from `/dev/tty`, which the standalone viewer needs when a patch arrives on stdin. +Crossterm features are shared by the whole build, so a host that reads its own input should add `default-features = false` and enable `clipboard` only if it wants the native clipboard. ## Ownership