ci: refactor xtask / toml formatting (#1602)

- format toml files using taplo
- add toml formatting check to CI
- use xtask consistently from bacon
- refactor xtask commands to take params instead of multiple commands
This commit is contained in:
Josh McKinney 2025-01-14 14:20:05 -08:00 committed by GitHub
parent da05957fa0
commit 4a871f993e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 461 additions and 587 deletions

View File

@ -28,7 +28,11 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
with: { components: rustfmt } with: { components: rustfmt }
- run: cargo xtask lint-formatting - uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: taplo-cli
- run: cargo xtask format --check
# Check for typos in the codebase. # Check for typos in the codebase.
# See <https://github.com/crate-ci/typos/> # See <https://github.com/crate-ci/typos/>
@ -55,7 +59,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: bnjbvr/cargo-machete@v0.7.0 - uses: bnjbvr/cargo-machete@v0.7.0
# Run cargo clippy. # Run cargo clippy.
@ -67,7 +70,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with: { components: clippy } with: { components: clippy }
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo xtask lint-clippy - run: cargo xtask clippy
# Run markdownlint on all markdown files in the repository. # Run markdownlint on all markdown files in the repository.
lint-markdown: lint-markdown:
@ -114,7 +117,7 @@ jobs:
with: with:
toolchain: ${{ matrix.toolchain }} toolchain: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo xtask check - run: cargo xtask check --all-features
# Check if README.md is up-to-date with the crate's documentation. # Check if README.md is up-to-date with the crate's documentation.
check-readme: check-readme:
@ -124,7 +127,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-rdme - uses: taiki-e/install-action@cargo-rdme
- run: cargo xtask check-readme - run: cargo xtask readme --check
# Run cargo rustdoc with the same options that would be used by docs.rs, taking into account the # Run cargo rustdoc with the same options that would be used by docs.rs, taking into account the
# package.metadata.docs.rs configured in Cargo.toml. https://github.com/dtolnay/cargo-docs-rs # package.metadata.docs.rs configured in Cargo.toml. https://github.com/dtolnay/cargo-docs-rs
@ -138,7 +141,7 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/install@cargo-docs-rs - uses: dtolnay/install@cargo-docs-rs
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo xtask lint-docs - run: cargo xtask docs
# Run cargo test on the documentation of the crate. This will catch any code examples that don't # Run cargo test on the documentation of the crate. This will catch any code examples that don't
# compile, or any other issues in the documentation. # compile, or any other issues in the documentation.

12
.taplo.toml Normal file
View File

@ -0,0 +1,12 @@
include = ["**/*.toml"]
[formatting]
column_width = 100
reorder_keys = false
[[rule]]
include = ["**/Cargo.toml"]
keys = ["dependencies", "dev-dependencies", "build-dependencies", "workspace.dependencies"]
[rule.formatting]
reorder_keys = true

248
Cargo.lock generated
View File

@ -94,11 +94,12 @@ dependencies = [
[[package]] [[package]]
name = "anstyle-wincon" name = "anstyle-wincon"
version = "3.0.6" version = "3.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"once_cell",
"windows-sys 0.59.0", "windows-sys 0.59.0",
] ]
@ -143,7 +144,7 @@ dependencies = [
"argh_shared", "argh_shared",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -169,13 +170,13 @@ dependencies = [
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.83" version = "0.1.85"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -347,7 +348,7 @@ dependencies = [
"semver 1.0.24", "semver 1.0.24",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.9", "thiserror 2.0.11",
] ]
[[package]] [[package]]
@ -373,9 +374,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.5" version = "1.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b"
dependencies = [ dependencies = [
"shlex", "shlex",
] ]
@ -445,9 +446,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.23" version = "4.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -455,9 +456,9 @@ dependencies = [
[[package]] [[package]]
name = "clap-cargo" name = "clap-cargo"
version = "0.15.1" version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e3340d63f960ad376843dd750fb2aa4ac1b79e10775a070882bd135edfce303" checksum = "d546f0e84ff2bfa4da1ce9b54be42285767ba39c688572ca32412a09a73851e5"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"cargo_metadata", "cargo_metadata",
@ -473,14 +474,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2678fade3b77aa3a8ff3aae87e9c008d3fb00473a41c71fbf74e91c8c7b37e84" checksum = "2678fade3b77aa3a8ff3aae87e9c008d3fb00473a41c71fbf74e91c8c7b37e84"
dependencies = [ dependencies = [
"clap", "clap",
"log", "tracing-core",
] ]
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.23" version = "4.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -490,14 +491,14 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.5.18" version = "4.5.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -560,9 +561,9 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]] [[package]]
name = "compact_str" name = "compact_str"
version = "0.8.0" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32"
dependencies = [ dependencies = [
"castaway", "castaway",
"cfg-if", "cfg-if",
@ -741,7 +742,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim 0.11.1", "strsim 0.11.1",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -752,7 +753,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -840,7 +841,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -1051,7 +1052,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -1121,9 +1122,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.1" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]] [[package]]
name = "half" name = "half"
@ -1412,7 +1413,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -1485,7 +1486,7 @@ dependencies = [
"indoc", "indoc",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -1541,9 +1542,9 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.76" version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"wasm-bindgen", "wasm-bindgen",
@ -1622,9 +1623,9 @@ dependencies = [
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.4.14" version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]] [[package]]
name = "litemap" name = "litemap"
@ -1650,9 +1651,9 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.22" version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
[[package]] [[package]]
name = "lru" name = "lru"
@ -1975,7 +1976,7 @@ dependencies = [
"by_address", "by_address",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -2030,7 +2031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc"
dependencies = [ dependencies = [
"memchr", "memchr",
"thiserror 2.0.9", "thiserror 2.0.11",
"ucd-trie", "ucd-trie",
] ]
@ -2054,7 +2055,7 @@ dependencies = [
"pest_meta", "pest_meta",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -2070,9 +2071,9 @@ dependencies = [
[[package]] [[package]]
name = "phf" name = "phf"
version = "0.11.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
dependencies = [ dependencies = [
"phf_macros", "phf_macros",
"phf_shared", "phf_shared",
@ -2080,9 +2081,9 @@ dependencies = [
[[package]] [[package]]
name = "phf_codegen" name = "phf_codegen"
version = "0.11.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a"
dependencies = [ dependencies = [
"phf_generator", "phf_generator",
"phf_shared", "phf_shared",
@ -2090,9 +2091,9 @@ dependencies = [
[[package]] [[package]]
name = "phf_generator" name = "phf_generator"
version = "0.11.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
dependencies = [ dependencies = [
"phf_shared", "phf_shared",
"rand 0.8.5", "rand 0.8.5",
@ -2100,51 +2101,51 @@ dependencies = [
[[package]] [[package]]
name = "phf_macros" name = "phf_macros"
version = "0.11.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"
dependencies = [ dependencies = [
"phf_generator", "phf_generator",
"phf_shared", "phf_shared",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
name = "phf_shared" name = "phf_shared"
version = "0.11.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
dependencies = [ dependencies = [
"siphasher", "siphasher 1.0.1",
] ]
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.1.7" version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916"
dependencies = [ dependencies = [
"pin-project-internal", "pin-project-internal",
] ]
[[package]] [[package]]
name = "pin-project-internal" name = "pin-project-internal"
version = "1.1.7" version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.15" version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -2216,18 +2217,18 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.92" version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.37" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -2447,7 +2448,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"strum", "strum",
"thiserror 2.0.9", "thiserror 2.0.11",
"unicode-segmentation", "unicode-segmentation",
"unicode-truncate", "unicode-truncate",
"unicode-width", "unicode-width",
@ -2655,7 +2656,7 @@ dependencies = [
"regex", "regex",
"relative-path", "relative-path",
"rustc_version", "rustc_version",
"syn 2.0.91", "syn 2.0.96",
"unicode-ident", "unicode-ident",
] ]
@ -2682,9 +2683,9 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.42" version = "0.38.43"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6"
dependencies = [ dependencies = [
"bitflags 2.7.0", "bitflags 2.7.0",
"errno", "errno",
@ -2695,9 +2696,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.20" version = "0.23.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8"
dependencies = [ dependencies = [
"log", "log",
"once_cell", "once_cell",
@ -2739,9 +2740,9 @@ dependencies = [
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.18" version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
[[package]] [[package]]
name = "ryu" name = "ryu"
@ -2784,9 +2785,9 @@ dependencies = [
[[package]] [[package]]
name = "security-framework" name = "security-framework"
version = "3.1.0" version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81d3f8c9bfcc3cbb6b0179eb57042d75b1582bdc65c3cb95f3fa999509c03cbc" checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316"
dependencies = [ dependencies = [
"bitflags 2.7.0", "bitflags 2.7.0",
"core-foundation", "core-foundation",
@ -2797,9 +2798,9 @@ dependencies = [
[[package]] [[package]]
name = "security-framework-sys" name = "security-framework-sys"
version = "2.13.0" version = "2.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5" checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32"
dependencies = [ dependencies = [
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
@ -2849,7 +2850,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -2954,13 +2955,13 @@ dependencies = [
[[package]] [[package]]
name = "simple_asn1" name = "simple_asn1"
version = "0.6.2" version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb"
dependencies = [ dependencies = [
"num-bigint", "num-bigint",
"num-traits", "num-traits",
"thiserror 1.0.69", "thiserror 2.0.11",
"time", "time",
] ]
@ -2979,6 +2980,12 @@ version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "siphasher"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.9" version = "0.4.9"
@ -3012,7 +3019,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -3074,7 +3081,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion", "rustversion",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -3096,9 +3103,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.91" version = "2.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3119,17 +3126,18 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.14.0" version = "3.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",
"getrandom",
"once_cell", "once_cell",
"rustix", "rustix",
"windows-sys 0.59.0", "windows-sys 0.59.0",
@ -3197,7 +3205,7 @@ dependencies = [
"semver 0.11.0", "semver 0.11.0",
"sha2", "sha2",
"signal-hook", "signal-hook",
"siphasher", "siphasher 0.3.11",
"tempfile", "tempfile",
"terminfo", "terminfo",
"termios", "termios",
@ -3224,11 +3232,11 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.9" version = "2.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc"
dependencies = [ dependencies = [
"thiserror-impl 2.0.9", "thiserror-impl 2.0.11",
] ]
[[package]] [[package]]
@ -3239,18 +3247,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "2.0.9" version = "2.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -3339,7 +3347,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -3473,7 +3481,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -3619,9 +3627,9 @@ dependencies = [
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.11.0" version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" checksum = "744018581f9a3454a9e15beb8a33b017183f1e7c0cd170232a2d1453b23a51c4"
dependencies = [ dependencies = [
"atomic", "atomic",
"getrandom", "getrandom",
@ -3675,34 +3683,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.99" version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"once_cell", "once_cell",
"rustversion",
"wasm-bindgen-macro", "wasm-bindgen-macro",
] ]
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.99" version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"log", "log",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.99" version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -3710,22 +3719,25 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.99" version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.99" version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]
[[package]] [[package]]
name = "weather" name = "weather"
@ -3739,9 +3751,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.76" version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -3779,7 +3791,7 @@ dependencies = [
"once_cell", "once_cell",
"sha2", "sha2",
"thiserror 1.0.69", "thiserror 1.0.69",
"uuid 1.11.0", "uuid 1.12.0",
] ]
[[package]] [[package]]
@ -3954,9 +3966,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.20" version = "0.6.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -3983,8 +3995,8 @@ dependencies = [
"clap-verbosity-flag", "clap-verbosity-flag",
"color-eyre", "color-eyre",
"duct", "duct",
"itertools 0.13.0",
"tracing", "tracing",
"tracing-log",
"tracing-subscriber", "tracing-subscriber",
] ]
@ -4014,7 +4026,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
"synstructure", "synstructure",
] ]
@ -4036,7 +4048,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]
[[package]] [[package]]
@ -4056,7 +4068,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
"synstructure", "synstructure",
] ]
@ -4085,5 +4097,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.91", "syn 2.0.96",
] ]

View File

@ -47,8 +47,8 @@ strum = { version = "0.26.3", features = ["derive"] }
termwiz = { version = "0.22.0" } termwiz = { version = "0.22.0" }
unicode-segmentation = "1.12.0" unicode-segmentation = "1.12.0"
# See <https://github.com/ratatui/ratatui/issues/1271> for information about why we pin unicode-width # See <https://github.com/ratatui/ratatui/issues/1271> for information about why we pin unicode-width
unicode-width = "=0.2.0"
termion = "4.0.0" termion = "4.0.0"
unicode-width = "=0.2.0"
# Improve benchmark consistency # Improve benchmark consistency
[profile.bench] [profile.bench]

View File

@ -8,91 +8,57 @@
default_job = "check" default_job = "check"
[jobs.check] [jobs.check]
command = ["cargo", "check", "--all-features"] command = ["cargo", "xtask", "check"]
need_stdout = false need_stdout = false
[jobs.check-all] [jobs.check-all]
command = ["cargo", "check", "--all-targets", "--all-features"] command = ["cargo", "xtask", "check", "--all-features"]
need_stdout = false need_stdout = false
[jobs.check-crossterm] [jobs.check-crossterm]
command = ["cargo", "check", "--all-targets", "--no-default-features", "--features", "crossterm"] command = ["cargo", "xtask", "check-crossterm"]
need_stdout = false need_stdout = false
[jobs.check-termion] [jobs.check-termion]
command = ["cargo", "check", "--all-targets", "--no-default-features", "--features", "termion"] command = ["cargo", "xtask", "check-termion"]
need_stdout = false need_stdout = false
[jobs.check-termwiz] [jobs.check-termwiz]
command = ["cargo", "check", "--all-targets", "--no-default-features", "--features", "termwiz"] command = ["cargo", "xtask", "check-termwiz"]
need_stdout = false need_stdout = false
[jobs.clippy-all] [jobs.clippy-all]
command = ["cargo", "xtask", "lint-clippy"] command = ["cargo", "xtask", "clippy"]
need_stdout = false need_stdout = false
[jobs.test] [jobs.test]
command = ["cargo", "test", "--all-features"] command = ["cargo", "xtask", "test"]
need_stdout = true need_stdout = true
[jobs.test-unit] [jobs.test-unit]
command = ["cargo", "test", "--lib", "--all-features"] command = ["cargo", "xtask", "test-libs"]
need_stdout = true need_stdout = true
[jobs.doc] [jobs.doc]
command = [ command = ["cargo", "xtask", "docs"]
"cargo",
"+nightly",
"doc",
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"--all-features",
"--no-deps",
]
env.RUSTDOCFLAGS = "--cfg docsrs"
need_stdout = false need_stdout = false
# If the doc compiles, then it opens in your browser and bacon switches
# to the previous job
[jobs.doc-open] [jobs.doc-open]
command = [ command = ["cargo", "xtask", "docs", "--open"]
"cargo", on_success = "job:doc"
"+nightly",
"doc",
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"--all-features",
"--no-deps",
"--open",
]
env.RUSTDOCFLAGS = "--cfg docsrs"
need_stdout = false need_stdout = false
on_success = "job:doc" # so that we don't open the browser at each change
[jobs.coverage] [jobs.coverage]
command = ["cargo", "llvm-cov", "--lcov", "--output-path", "target/lcov.info", "--all-features"] command = ["cargo", "xtask", "coverage"]
[jobs.coverage-unit-tests-only] [jobs.coverage-unit-tests-only]
command = [ command = ["cargo", "xtask", "coverage-unit"]
"cargo",
"llvm-cov",
"--lcov",
"--output-path",
"target/lcov.info",
"--lib",
"--all-features",
]
[jobs.hack] [jobs.hack]
command = [ command = ["cargo", "xtask", "hack"]
"cargo",
"hack", [jobs.format]
"test", command = ["cargo", "xtask", "format"]
"--lib",
"--each-feature",
# "--all-targets",
"--workspace",
]
# You may define here keybindings that would be specific to # You may define here keybindings that would be specific to
# a project, for example a shortcut to launch a specific job. # a project, for example a shortcut to launch a specific job.
@ -107,3 +73,4 @@ v = "job:coverage"
ctrl-v = "job:coverage-unit-tests-only" ctrl-v = "job:coverage-unit-tests-only"
u = "job:test-unit" u = "job:test-unit"
n = "job:nextest" n = "job:nextest"
f = "job:format"

View File

@ -30,9 +30,9 @@ unstable-backend-writer = []
[dependencies] [dependencies]
document-features = { workspace = true, optional = true } document-features = { workspace = true, optional = true }
instability.workspace = true
ratatui-core = { workspace = true } ratatui-core = { workspace = true }
termion.workspace = true termion.workspace = true
instability.workspace = true
[dev-dependencies] [dev-dependencies]
rstest.workspace = true rstest.workspace = true

View File

@ -48,17 +48,17 @@ unstable-rendered-line-info = []
[dependencies] [dependencies]
bitflags.workspace = true bitflags.workspace = true
itertools.workspace = true document-features = { workspace = true, optional = true }
indoc.workspace = true indoc.workspace = true
instability.workspace = true instability.workspace = true
itertools.workspace = true
line-clipping = "0.2.1"
ratatui-core = { workspace = true } ratatui-core = { workspace = true }
serde = { workspace = true, optional = true }
strum.workspace = true strum.workspace = true
time = { version = "0.3.11", optional = true, features = ["local-offset"] } time = { version = "0.3.11", optional = true, features = ["local-offset"] }
unicode-segmentation.workspace = true unicode-segmentation.workspace = true
unicode-width.workspace = true unicode-width.workspace = true
serde = { workspace = true, optional = true }
document-features = { workspace = true, optional = true }
line-clipping = "0.2.1"
[dev-dependencies] [dev-dependencies]
color-eyre.workspace = true color-eyre.workspace = true

248
xtask/Cargo.lock generated
View File

@ -1,248 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "anstream"
version = "0.6.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56"
[[package]]
name = "anstyle-parse"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "clap"
version = "4.5.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8"
dependencies = [
"clap_builder",
"clap_derive",
]
[[package]]
name = "clap-cargo"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b2ea69cefa96b848b73ad516ad1d59a195cdf9263087d977f648a818c8b43e"
dependencies = [
"anstyle",
"clap",
]
[[package]]
name = "clap_builder"
version = "4.5.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
[[package]]
name = "colorchoice"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "proc-macro2"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "2.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "xtask"
version = "0.1.0"
dependencies = [
"clap",
"clap-cargo",
]

View File

@ -8,9 +8,9 @@ license.workspace = true
cargo_metadata = "0.19.1" cargo_metadata = "0.19.1"
clap = { version = "4.5.23", features = ["derive"] } clap = { version = "4.5.23", features = ["derive"] }
clap-cargo = { version = "0.15.1", features = ["cargo_metadata"] } clap-cargo = { version = "0.15.1", features = ["cargo_metadata"] }
clap-verbosity-flag = "3.0.2" clap-verbosity-flag = { version = "3.0.2", default-features = false, features = ["tracing"] }
color-eyre = "0.6.3" color-eyre = "0.6.3"
duct = "0.13.7" duct = "0.13.7"
itertools.workspace = true
tracing = "0.1.40" tracing = "0.1.40"
tracing-log = "0.2.0" tracing-subscriber = { version = "0.3.18" }
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

View File

@ -11,14 +11,13 @@ use clap::{Parser, Subcommand, ValueEnum};
use clap_verbosity_flag::{InfoLevel, Verbosity}; use clap_verbosity_flag::{InfoLevel, Verbosity};
use color_eyre::{eyre::Context, Result}; use color_eyre::{eyre::Context, Result};
use duct::cmd; use duct::cmd;
use tracing::level_filters::LevelFilter; use itertools::{Itertools, Position};
use tracing_log::AsTrace;
fn main() -> Result<()> { fn main() -> Result<()> {
color_eyre::install()?; color_eyre::install()?;
let args = Args::parse(); let args = Args::parse();
tracing_subscriber::fmt() tracing_subscriber::fmt()
.with_max_level(args.log_level()) .with_max_level(args.verbosity)
.without_time() .without_time()
.init(); .init();
@ -46,10 +45,6 @@ impl Args {
fn run(self) -> Result<()> { fn run(self) -> Result<()> {
self.command.run() self.command.run()
} }
fn log_level(&self) -> LevelFilter {
self.verbosity.log_level_filter().as_trace()
}
} }
#[derive(Clone, Debug, Subcommand)] #[derive(Clone, Debug, Subcommand)]
@ -61,57 +56,56 @@ enum Command {
#[command(visible_alias = "b")] #[command(visible_alias = "b")]
Build, Build,
/// Run cargo check
#[command(visible_alias = "c")] #[command(visible_alias = "c")]
Check, Check(CheckCommand),
/// Check if README.md is up-to-date /// Run cargo check with crossterm feature
#[command(visible_alias = "cr")] #[command(visible_alias = "cc")]
CheckReadme, CheckCrossterm,
/// Run cargo check with termion feature
#[command(visible_alias = "ct")]
CheckTermion,
/// Run cargo check with termwiz feature
#[command(visible_alias = "cw")]
CheckTermwiz,
/// Check if README.md is up-to-date (using cargo-rdme)
#[command(visible_alias = "cr", alias = "rdme")]
Readme(ReadmeCommand),
/// Generate code coverage report /// Generate code coverage report
#[command(visible_alias = "cov")] #[command(visible_alias = "cov")]
Coverage, Coverage,
/// Generate code coverage for unit tests only
#[command(visible_alias = "covu")]
CoverageUnit,
/// Lint formatting, typos, clippy, and docs /// Lint formatting, typos, clippy, and docs
#[command(visible_alias = "l")] #[command(visible_alias = "l")]
Lint, Lint,
/// Run clippy on the project /// Run clippy on the project
#[command(visible_alias = "cl")] #[command(visible_alias = "cl")]
LintClippy, Clippy(ClippyCommand),
/// Check documentation for errors and warnings /// Check documentation for errors and warnings
#[command(visible_alias = "d")] #[command(name = "docs", visible_alias = "d")]
LintDocs, Docs(DocsCommand),
/// Check for formatting issues in the project /// Check for formatting issues in the project
#[command(visible_alias = "lf")] #[command(visible_aliases = ["fmt", "f"])]
LintFormatting, Format(FormatCommand),
/// Lint markdown files /// Lint markdown files
#[command(visible_alias = "md")] #[command(visible_alias = "md")]
LintMarkdown, LintMarkdown,
/// Check for typos in the project /// Check for typos in the project
#[command(visible_alias = "lt")] #[command(visible_alias = "ty")]
LintTypos, Typos(TyposCommand),
/// Fix clippy warnings in the project
#[command(visible_alias = "fc")]
FixClippy,
/// Fix formatting issues in the project
#[command(visible_alias = "fmt")]
FixFormatting,
/// Fix README.md (by running cargo-rdme)
#[command(visible_alias = "fr")]
FixReadme,
/// Fix typos in the project
#[command(visible_alias = "typos")]
FixTypos,
/// Run tests /// Run tests
#[command(visible_alias = "t")] #[command(visible_alias = "t")]
@ -128,6 +122,58 @@ enum Command {
/// Run lib tests /// Run lib tests
#[command(visible_alias = "tl")] #[command(visible_alias = "tl")]
TestLibs, TestLibs,
/// Run cargo hack to test each feature in isolation
#[command(visible_alias = "h")]
Hack,
}
/// Run cargo check
#[derive(Clone, Debug, clap::Args)]
struct CheckCommand {
/// Check all features
#[arg(long, visible_alias = "all")]
all_features: bool,
}
/// Check documentation for errors and warnings
#[derive(Clone, Debug, clap::Args)]
struct DocsCommand {
/// Open the documentation in the browser
#[arg(long)]
open: bool,
}
/// Check for formatting issues in the project
#[derive(Clone, Debug, clap::Args)]
struct FormatCommand {
/// Check formatting issues
#[arg(long)]
check: bool,
}
/// Run clippy on the project
#[derive(Clone, Debug, clap::Args)]
struct ClippyCommand {
/// Fix clippy warnings
#[arg(long)]
fix: bool,
}
/// Check if README.md is up-to-date (using cargo-rdme)
#[derive(Clone, Debug, clap::Args)]
struct ReadmeCommand {
/// Check if README.md is up-to-date
#[arg(long)]
check: bool,
}
/// Check for typos in the project
#[derive(Clone, Debug, clap::Args)]
struct TyposCommand {
/// Fix typos
#[arg(long)]
fix: bool,
} }
#[derive(Clone, Debug, ValueEnum, PartialEq, Eq)] #[derive(Clone, Debug, ValueEnum, PartialEq, Eq)]
@ -142,23 +188,24 @@ impl Command {
match self { match self {
Command::CI => ci(), Command::CI => ci(),
Command::Build => build(), Command::Build => build(),
Command::Check => check(), Command::Check(command) => command.run(),
Command::CheckReadme => check_readme(), Command::CheckCrossterm => check_crossterm(),
Command::CheckTermion => check_termion(),
Command::CheckTermwiz => check_termwiz(),
Command::Readme(command) => command.run(),
Command::Coverage => coverage(), Command::Coverage => coverage(),
Command::CoverageUnit => coverage_unit(),
Command::Lint => lint(), Command::Lint => lint(),
Command::LintClippy => lint_clippy(), Command::Clippy(command) => command.run(),
Command::LintDocs => lint_docs(), Command::Docs(command) => command.run(),
Command::LintFormatting => lint_format(), Command::Format(command) => command.run(),
Command::LintTypos => lint_typos(), Command::Typos(command) => command.run(),
Command::LintMarkdown => lint_markdown(), Command::LintMarkdown => lint_markdown(),
Command::FixClippy => fix_clippy(),
Command::FixFormatting => fix_format(),
Command::FixReadme => fix_readme(),
Command::FixTypos => fix_typos(),
Command::Test => test(), Command::Test => test(),
Command::TestBackend { backend } => test_backend(backend), Command::TestBackend { backend } => test_backend(backend),
Command::TestDocs => test_docs(), Command::TestDocs => test_docs(),
Command::TestLibs => test_libs(), Command::TestLibs => test_libs(),
Command::Hack => hack(),
} }
} }
} }
@ -176,24 +223,71 @@ fn build() -> Result<()> {
run_cargo(vec!["build", "--all-targets", "--all-features"]) run_cargo(vec!["build", "--all-targets", "--all-features"])
} }
/// Run cargo check impl CheckCommand {
fn check() -> Result<()> { fn run(self) -> Result<()> {
if self.all_features {
run_cargo(vec!["check", "--all-targets", "--all-features"]) run_cargo(vec!["check", "--all-targets", "--all-features"])
} else {
run_cargo(vec!["check", "--all-targets"])
}
}
} }
/// Run cargo-rdme to check if README.md is up-to-date with the library documentation /// Run cargo check with crossterm feature
fn check_readme() -> Result<()> { fn check_crossterm() -> Result<()> {
run_cargo(vec![
"check",
"--all-targets",
"--all-features",
"--no-default-features",
"--features",
"crossterm",
])
}
/// Run cargo check with termion feature
fn check_termion() -> Result<()> {
run_cargo(vec![
"check",
"--all-targets",
"--all-features",
"--no-default-features",
"--features",
"termion",
])
}
/// Run cargo check with termwiz feature
fn check_termwiz() -> Result<()> {
run_cargo(vec![
"check",
"--all-targets",
"--all-features",
"--no-default-features",
"--features",
"termwiz",
])
}
impl ReadmeCommand {
fn run(self) -> Result<()> {
let args = if self.check {
vec!["rdme", "--check"]
} else {
vec!["rdme"]
};
for package in workspace_packages(TargetKind::Lib)? { for package in workspace_packages(TargetKind::Lib)? {
run_cargo(vec!["rdme", "--workspace-project", &package, "--check"])?; if package == "ratatui" {
// Skip the main crate as we removed rdme
continue;
}
let mut package_args = args.clone();
package_args.push("--workspace-project");
package_args.push(&package);
run_cargo(package_args)?;
} }
Ok(()) Ok(())
} }
fn fix_readme() -> Result<()> {
for package in workspace_packages(TargetKind::Lib)? {
run_cargo(vec!["rdme", "--workspace-project", &package])?;
}
Ok(())
} }
/// Generate code coverage report /// Generate code coverage report
@ -207,21 +301,33 @@ fn coverage() -> Result<()> {
]) ])
} }
/// Generate code coverage for unit tests only
fn coverage_unit() -> Result<()> {
run_cargo(vec![
"llvm-cov",
"--lcov",
"--output-path",
"target/lcov-unit.info",
"--all-features",
"--lib",
])
}
/// Lint formatting, typos, clippy, and docs (and a soft fail on markdown) /// Lint formatting, typos, clippy, and docs (and a soft fail on markdown)
fn lint() -> Result<()> { fn lint() -> Result<()> {
lint_clippy()?; ClippyCommand { fix: false }.run()?;
lint_docs()?; DocsCommand { open: false }.run()?;
lint_format()?; FormatCommand { check: true }.run()?;
lint_typos()?; TyposCommand { fix: false }.run()?;
if let Err(err) = lint_markdown() { if let Err(err) = lint_markdown() {
tracing::warn!("known issue: markdownlint is currently noisy and can be ignored: {err}"); tracing::warn!("known issue: markdownlint is currently noisy and can be ignored: {err}");
} }
Ok(()) Ok(())
} }
/// Run clippy on the project impl ClippyCommand {
fn lint_clippy() -> Result<()> { fn run(self) -> Result<()> {
run_cargo(vec![ let mut args = vec![
"clippy", "clippy",
"--all-targets", "--all-targets",
"--all-features", "--all-features",
@ -230,31 +336,27 @@ fn lint_clippy() -> Result<()> {
"--", "--",
"-D", "-D",
"warnings", "warnings",
]) ];
if self.fix {
args.push("--fix");
}
run_cargo(args)
}
} }
/// Fix clippy warnings in the project impl DocsCommand {
fn fix_clippy() -> Result<()> { fn run(self) -> Result<()> {
run_cargo(vec![ let packages = workspace_packages(TargetKind::Lib)?;
"clippy", for (position, package) in packages.iter().with_position() {
"--all-targets", let mut args = vec!["docs-rs", "--package", &package];
"--all-features", if self.open && matches!(position, Position::Last | Position::Only) {
"--tests", args.push("--open");
"--benches",
"--",
"-D",
"warnings",
"--fix",
])
} }
run_cargo_nightly(args)?;
/// Check that docs build without errors using flags for docs.rs
fn lint_docs() -> Result<()> {
for package in workspace_packages(TargetKind::Lib)? {
run_cargo_nightly(vec!["docs-rs", "--package", &package])?;
} }
Ok(()) Ok(())
} }
}
/// Return the available packages in the workspace /// Return the available packages in the workspace
fn workspace_packages(kind: TargetKind) -> Result<Vec<String>> { fn workspace_packages(kind: TargetKind) -> Result<Vec<String>> {
@ -270,14 +372,30 @@ fn workspace_packages(kind: TargetKind) -> Result<Vec<String>> {
Ok(packages) Ok(packages)
} }
/// Lint formatting issues in the project impl FormatCommand {
fn lint_format() -> Result<()> { fn run(self) -> Result<()> {
run_cargo_nightly(vec!["fmt", "--all", "--check"]) self.run_rustfmt()?;
self.run_taplo()?;
Ok(())
} }
/// Fix formatting issues in the project fn run_rustfmt(&self) -> Result<(), color_eyre::eyre::Error> {
fn fix_format() -> Result<()> { let mut args = vec!["fmt", "--all"];
run_cargo_nightly(vec!["fmt", "--all"]) if self.check {
args.push("--check");
}
run_cargo_nightly(args)?;
Ok(())
}
fn run_taplo(&self) -> Result<(), color_eyre::eyre::Error> {
let mut args = vec!["format", "--colors", "always"];
if self.check {
args.push("--check");
}
cmd("taplo", args).run_with_trace()?;
Ok(())
}
} }
/// Lint markdown files using [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) /// Lint markdown files using [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2)
@ -286,16 +404,15 @@ fn lint_markdown() -> Result<()> {
Ok(()) Ok(())
} }
/// Check for typos in the project using [typos-cli](https://github.com/crate-ci/typos/) impl TyposCommand {
fn lint_typos() -> Result<()> { fn run(self) -> Result<()> {
if self.fix {
cmd!("typos", "--write-changes").run_with_trace()?;
} else {
cmd!("typos").run_with_trace()?; cmd!("typos").run_with_trace()?;
}
Ok(()) Ok(())
} }
/// Fix typos in the project
fn fix_typos() -> Result<()> {
cmd!("typos", "-w").run_with_trace()?;
Ok(())
} }
/// Run tests for libs, backends, and docs /// Run tests for libs, backends, and docs
@ -334,7 +451,18 @@ fn test_docs() -> Result<()> {
/// Run lib tests for the workspace's default packages /// Run lib tests for the workspace's default packages
fn test_libs() -> Result<()> { fn test_libs() -> Result<()> {
run_cargo(vec!["test", "--all-targets", "--all-features"]) run_cargo(vec!["test", "--lib", "--all-targets", "--all-features"])
}
/// Run cargo hack to test each feature in isolation
fn hack() -> Result<()> {
run_cargo(vec![
"hack",
"test",
"--lib",
"--each-feature",
"--workspace",
])
} }
/// Run a cargo subcommand with the default toolchain /// Run a cargo subcommand with the default toolchain