cargo-options-0.7.4/.cargo_vcs_info.json0000644000000001360000000000100136300ustar { "git": { "sha1": "086d7470cae34b0e694a62237e258fbd35384e93" }, "path_in_vcs": "" }cargo-options-0.7.4/.codespellrc000064400000000000000000000000751046102023000147220ustar 00000000000000[codespell] ignore-words-list = crate skip = ./.git,./target cargo-options-0.7.4/.github/workflows/CI.yml000064400000000000000000000023711046102023000170360ustar 00000000000000on: push: branches: - main pull_request: name: CI concurrency: group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true jobs: check: name: Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: cargo check --all test: name: Test Suite runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] rust: [stable, '1.67.0'] steps: - uses: actions/checkout@v4 - run: rustup override set ${{ matrix.rust }} - name: Cache cargo build uses: Swatinem/rust-cache@v2 - run: cargo test if: matrix.rust != '1.67.0' - run: cargo build if: matrix.rust == '1.67.0' fmt: name: Rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: cargo fmt --all -- --check clippy_check: name: Clippy Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: cargo clippy --all-features spellcheck: name: spellcheck runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: codespell-project/actions-codespell@master cargo-options-0.7.4/.gitignore000064400000000000000000000000101046102023000143770ustar 00000000000000/target cargo-options-0.7.4/Cargo.lock0000644000000507200000000000100116070ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "anstream" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon 1.0.2", "colorchoice", "is-terminal", "utf8parse", ] [[package]] name = "anstream" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon 3.0.1", "colorchoice", "utf8parse", ] [[package]] name = "anstyle" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" [[package]] name = "anstyle-parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" dependencies = [ "anstyle", "windows-sys", ] [[package]] name = "anstyle-wincon" version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys", ] [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "cargo-options" version = "0.7.4" dependencies = [ "anstyle", "clap", "trycmd", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" version = "4.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb690e81c7840c0d7aade59f242ea3b41b9bc27bcd5997890e7702ae4b32e487" dependencies = [ "clap_builder", "clap_derive", "once_cell", ] [[package]] name = "clap_builder" version = "4.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ed2e96bc16d8d740f6f48d663eddf4b8a0983e79210fd55479b7bcd0a69860e" dependencies = [ "anstream 0.3.2", "anstyle", "clap_lex", "strsim", "terminal_size", ] [[package]] name = "clap_derive" version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", "proc-macro2", "quote", "syn", ] [[package]] name = "clap_lex" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "colorchoice" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "content_inspector" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" dependencies = [ "memchr", ] [[package]] name = "crossbeam-deque" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "memoffset", "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] [[package]] name = "dunce" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys", ] [[package]] name = "escargot" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "768064bd3a0e2bedcba91dc87ace90beea91acc41b6a01a3ca8e9aa8827461bf" dependencies = [ "log", "once_cell", "serde", "serde_json", ] [[package]] name = "fastrand" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "filetime" version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", "redox_syscall 0.3.5", "windows-sys", ] [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hashbrown" version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "humantime-serde" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c" dependencies = [ "humantime", "serde", ] [[package]] name = "indexmap" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "io-lifetimes" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi", "libc", "windows-sys", ] [[package]] name = "is-terminal" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", "rustix 0.38.25", "windows-sys", ] [[package]] name = "itoa" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "libc" version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "linux-raw-sys" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] [[package]] name = "normalize-line-endings" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "once_cell" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "os_pipe" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177" dependencies = [ "libc", "windows-sys", ] [[package]] name = "proc-macro2" version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "rayon" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", ] [[package]] name = "rayon-core" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ "crossbeam-deque", "crossbeam-utils", ] [[package]] name = "redox_syscall" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "redox_syscall" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "rustix" version = "0.37.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" dependencies = [ "bitflags 1.3.2", "errno", "io-lifetimes", "libc", "linux-raw-sys 0.3.8", "windows-sys", ] [[package]] name = "rustix" version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", "libc", "linux-raw-sys 0.4.11", "windows-sys", ] [[package]] name = "ryu" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ "winapi-util", ] [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", "serde", ] [[package]] name = "serde_spanned" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] [[package]] name = "shlex" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "similar" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597" [[package]] name = "snapbox" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b377c0b6e4715c116473d8e40d51e3fa5b0a2297ca9b2a931ba800667b259ed" dependencies = [ "anstream 0.6.4", "anstyle", "content_inspector", "dunce", "escargot", "filetime", "libc", "normalize-line-endings", "os_pipe", "similar", "snapbox-macros", "tempfile", "wait-timeout", "walkdir", "windows-sys", ] [[package]] name = "snapbox-macros" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed1559baff8a696add3322b9be3e940d433e7bb4e38d79017205fd37ff28b28e" dependencies = [ "anstream 0.6.4", ] [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "tempfile" version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.4.1", "rustix 0.38.25", "windows-sys", ] [[package]] name = "terminal_size" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ "rustix 0.37.27", "windows-sys", ] [[package]] name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] [[package]] name = "toml_edit" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", "winnow", ] [[package]] name = "trycmd" version = "0.14.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed009372a42fb103e6f8767b9222925485e03cca032b700d203e2c5b67bee4fb" dependencies = [ "glob", "humantime", "humantime-serde", "rayon", "serde", "shlex", "snapbox", "toml_edit", ] [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "wait-timeout" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" dependencies = [ "libc", ] [[package]] name = "walkdir" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", ] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" dependencies = [ "memchr", ] cargo-options-0.7.4/Cargo.toml0000644000000017120000000000100116270ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" name = "cargo-options" version = "0.7.4" description = "Reusable common Cargo command line options" readme = "README.md" keywords = [ "clap", "cargo", "cli", ] license = "MIT" repository = "https://github.com/messense/cargo-options" [dependencies.anstyle] version = "1.0.2" [dependencies.clap] version = "4.0.0" features = [ "derive", "env", "wrap_help", "unstable-styles", ] [dev-dependencies.trycmd] version = "0.14.0" features = ["examples"] cargo-options-0.7.4/Cargo.toml.orig000064400000000000000000000010551046102023000153100ustar 00000000000000[package] name = "cargo-options" version = "0.7.4" edition = "2021" description = "Reusable common Cargo command line options" license = "MIT" keywords = ["clap", "cargo", "cli"] readme = "README.md" repository = "https://github.com/messense/cargo-options" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anstyle = "1.0.2" clap = { version = "4.0.0", features = ["derive", "env", "wrap_help", "unstable-styles"] } [dev-dependencies] trycmd = { version = "0.14.0", features = ["examples"] } cargo-options-0.7.4/LICENSE000064400000000000000000000020511046102023000134230ustar 00000000000000MIT License Copyright (c) 2022 messense Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cargo-options-0.7.4/README.md000064400000000000000000000011571046102023000137030ustar 00000000000000# cargo-options [![GitHub Actions](https://github.com/messense/cargo-options/workflows/CI/badge.svg)](https://github.com/messense/cargo-options/actions?query=workflow%3ACI) [![Crates.io](https://img.shields.io/crates/v/cargo-options.svg)](https://crates.io/crates/cargo-options) [![docs.rs](https://docs.rs/cargo-options/badge.svg)](https://docs.rs/cargo-options/) Reusable common Cargo command line options. ## Installation Add it to your ``Cargo.toml``: ```bash cargo add cargo-options ``` ## License This work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file. cargo-options-0.7.4/examples/cargo-mimic.rs000064400000000000000000000014321046102023000167730ustar 00000000000000use cargo_options::{Build, Check, Clippy, Doc, Install, Metadata, Run, Rustc, Test}; use clap::Parser; #[derive(Debug, Parser)] #[command( name = "cargo-mimic", display_order = 1, styles = cargo_options::styles(), )] enum Opt { #[command(name = "build", aliases = &["b"] )] Build(Build), #[command(name = "clippy")] Clippy(Clippy), #[command(name = "check", aliases = &["c"])] Check(Check), #[command(name = "doc")] Doc(Doc), #[command(name = "install")] Install(Install), #[command(name = "metadata")] Metadata(Metadata), #[command(name = "rustc")] Rustc(Rustc), #[command(name = "run", alias = "r")] Run(Run), #[command(name = "test", alias = "t")] Test(Test), } fn main() { let _opt = Opt::parse(); } cargo-options-0.7.4/src/build.rs000064400000000000000000000140451046102023000146600ustar 00000000000000use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::process::Command; use clap::{ArgAction, Parser}; use crate::common::CommonOptions; use crate::heading; /// Compile a local package and all of its dependencies #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help build` for more detailed information." )] #[group(skip)] pub struct Build { #[command(flatten)] pub common: CommonOptions, /// Path to Cargo.toml #[arg(long, value_name = "PATH", help_heading = heading::MANIFEST_OPTIONS)] pub manifest_path: Option, /// Build artifacts in release mode, with optimizations #[arg(short = 'r', long, help_heading = heading::COMPILATION_OPTIONS)] pub release: bool, /// Ignore `rust-version` specification in packages #[arg(long)] pub ignore_rust_version: bool, /// Output build graph in JSON (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub unit_graph: bool, /// Package to build (see `cargo help pkgid`) #[arg( short = 'p', long = "package", value_name = "SPEC", action = ArgAction::Append, num_args=0..=1, help_heading = heading::PACKAGE_SELECTION, )] pub packages: Vec, /// Build all packages in the workspace #[arg(long, help_heading = heading::PACKAGE_SELECTION)] pub workspace: bool, /// Exclude packages from the build #[arg( long, value_name = "SPEC", action = ArgAction::Append, help_heading = heading::PACKAGE_SELECTION, )] pub exclude: Vec, /// Alias for workspace (deprecated) #[arg(long, help_heading = heading::PACKAGE_SELECTION)] pub all: bool, /// Build only this package's library #[arg(long, help_heading = heading::TARGET_SELECTION)] pub lib: bool, /// Build only the specified binary #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub bin: Vec, /// Build all binaries #[arg(long, help_heading = heading::TARGET_SELECTION)] pub bins: bool, /// Build only the specified example #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub example: Vec, /// Build all examples #[arg(long, help_heading = heading::TARGET_SELECTION)] pub examples: bool, /// Build only the specified test target #[arg( long, value_name = "NAME", action = ArgAction::Append, help_heading = heading::TARGET_SELECTION, )] pub test: Vec, /// Build all tests #[arg(long, help_heading = heading::TARGET_SELECTION)] pub tests: bool, /// Build only the specified bench target #[arg( long, value_name = "NAME", action = ArgAction::Append, help_heading = heading::TARGET_SELECTION, )] pub bench: Vec, /// Build all benches #[arg(long, help_heading = heading::TARGET_SELECTION)] pub benches: bool, /// Build all targets #[arg(long, help_heading = heading::TARGET_SELECTION)] pub all_targets: bool, /// Copy final artifacts to this directory (unstable) #[arg(long, value_name = "PATH", help_heading = heading::COMPILATION_OPTIONS)] pub out_dir: Option, /// Output the build plan in JSON (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub build_plan: bool, /// Outputs a future incompatibility report at the end of the build (unstable) #[arg(long)] pub future_incompat_report: bool, } impl Build { /// Build a `cargo build` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("build"); self.common.apply(&mut cmd); if let Some(path) = self.manifest_path.as_ref() { cmd.arg("--manifest-path").arg(path); } if self.release { cmd.arg("--release"); } if self.ignore_rust_version { cmd.arg("--ignore-rust-version"); } if self.unit_graph { cmd.arg("--unit-graph"); } for pkg in &self.packages { cmd.arg("--package").arg(pkg); } if self.workspace { cmd.arg("--workspace"); } for item in &self.exclude { cmd.arg("--exclude").arg(item); } if self.all { cmd.arg("--all"); } if self.lib { cmd.arg("--lib"); } for bin in &self.bin { cmd.arg("--bin").arg(bin); } if self.bins { cmd.arg("--bins"); } for example in &self.example { cmd.arg("--example").arg(example); } if self.examples { cmd.arg("--examples"); } for test in &self.test { cmd.arg("--test").arg(test); } if self.tests { cmd.arg("--tests"); } for bench in &self.bench { cmd.arg("--bench").arg(bench); } if self.benches { cmd.arg("--benches"); } if self.all_targets { cmd.arg("--all-targets"); } if let Some(dir) = self.out_dir.as_ref() { cmd.arg("--out-dir").arg(dir); } if self.build_plan { cmd.arg("--build-plan"); } if self.future_incompat_report { cmd.arg("--future-incompat-report"); } cmd } } impl Deref for Build { type Target = CommonOptions; fn deref(&self) -> &Self::Target { &self.common } } impl DerefMut for Build { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.common } } #[cfg(test)] mod test { use super::Build; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/src/check.rs000064400000000000000000000135561046102023000146440ustar 00000000000000use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::process::Command; use clap::{ArgAction, Parser}; use crate::common::CommonOptions; use crate::heading; /// `cargo check` options which are also a subset of `cargo clippy` #[derive(Clone, Debug, Default, Parser)] pub struct CheckOptions { /// Package to build (see `cargo help pkgid`) #[arg( short = 'p', long = "package", value_name = "SPEC", action = ArgAction::Append, num_args=0..=1, help_heading = heading::PACKAGE_SELECTION, )] pub packages: Vec, /// Check all packages in the workspace #[arg(long, help_heading = heading::PACKAGE_SELECTION)] pub workspace: bool, /// Exclude packages from the build #[arg( long, value_name = "SPEC", action = ArgAction::Append, help_heading = heading::PACKAGE_SELECTION, )] pub exclude: Vec, /// Alias for workspace (deprecated) #[arg(long, help_heading = heading::PACKAGE_SELECTION,)] pub all: bool, /// Check only this package's library #[arg(long, help_heading = heading::TARGET_SELECTION)] pub lib: bool, /// Check only the specified binary #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub bin: Vec, /// Check all binaries #[arg(long, help_heading = heading::TARGET_SELECTION)] pub bins: bool, /// Check only the specified example #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub example: Vec, /// Check all examples #[arg(long, help_heading = heading::TARGET_SELECTION)] pub examples: bool, /// Check only the specified test target #[arg( long, value_name = "NAME", action = ArgAction::Append, help_heading = heading::TARGET_SELECTION, )] pub test: Vec, /// Check all tests #[arg(long, help_heading = heading::TARGET_SELECTION)] pub tests: bool, /// Check only the specified bench target #[arg( long, value_name = "NAME", action = ArgAction::Append, help_heading = heading::TARGET_SELECTION, )] pub bench: Vec, /// Check all benches #[arg(long, help_heading = heading::TARGET_SELECTION)] pub benches: bool, /// Check all targets #[arg(long, help_heading = heading::TARGET_SELECTION)] pub all_targets: bool, /// Outputs a future incompatibility report at the end of the build (unstable) #[arg(long)] pub future_incompat_report: bool, } impl CheckOptions { pub fn apply(&self, cmd: &mut Command) { for pkg in &self.packages { cmd.arg("--package").arg(pkg); } if self.workspace { cmd.arg("--workspace"); } for item in &self.exclude { cmd.arg("--exclude").arg(item); } if self.all { cmd.arg("--all"); } if self.lib { cmd.arg("--lib"); } for bin in &self.bin { cmd.arg("--bin").arg(bin); } if self.bins { cmd.arg("--bins"); } for example in &self.example { cmd.arg("--example").arg(example); } if self.examples { cmd.arg("--examples"); } for test in &self.test { cmd.arg("--test").arg(test); } if self.tests { cmd.arg("--tests"); } for bench in &self.bench { cmd.arg("--bench").arg(bench); } if self.benches { cmd.arg("--benches"); } if self.all_targets { cmd.arg("--all-targets"); } if self.future_incompat_report { cmd.arg("--future-incompat-report"); } } } /// Check a local package and all of its dependencies for errors #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help check` for more detailed information." )] #[group(skip)] pub struct Check { #[command(flatten)] pub common: CommonOptions, #[command(flatten)] pub check: CheckOptions, /// Path to Cargo.toml #[arg(long, value_name = "PATH", help_heading = heading::MANIFEST_OPTIONS)] pub manifest_path: Option, /// Build artifacts in release mode, with optimizations #[arg(short = 'r', long, help_heading = heading::COMPILATION_OPTIONS)] pub release: bool, /// Ignore `rust-version` specification in packages #[arg(long)] pub ignore_rust_version: bool, /// Output build graph in JSON (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub unit_graph: bool, } impl Check { /// Build a `cargo check` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("check"); self.common.apply(&mut cmd); self.check.apply(&mut cmd); if let Some(path) = self.manifest_path.as_ref() { cmd.arg("--manifest-path").arg(path); } if self.release { cmd.arg("--release"); } if self.ignore_rust_version { cmd.arg("--ignore-rust-version"); } if self.unit_graph { cmd.arg("--unit-graph"); } cmd } } impl Deref for Check { type Target = CommonOptions; fn deref(&self) -> &Self::Target { &self.common } } impl DerefMut for Check { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.common } } #[cfg(test)] mod test { use super::Check; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/src/clippy.rs000064400000000000000000000052541046102023000150630ustar 00000000000000use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::process::Command; use clap::Parser; use crate::check::CheckOptions; use crate::common::CommonOptions; use crate::heading; /// Checks a package to catch common mistakes and improve your Rust code #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help clippy` for more detailed information." )] #[group(skip)] pub struct Clippy { #[command(flatten)] pub common: CommonOptions, #[command(flatten)] pub check: CheckOptions, /// Path to Cargo.toml #[arg(long, value_name = "PATH", help_heading = heading::MANIFEST_OPTIONS)] pub manifest_path: Option, /// Build artifacts in release mode, with optimizations #[arg(short = 'r', long, help_heading = heading::COMPILATION_OPTIONS)] pub release: bool, /// Ignore `rust-version` specification in packages #[arg(long)] pub ignore_rust_version: bool, /// Output build graph in JSON (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub unit_graph: bool, /// Ignore dependencies, run only on crate #[arg(long)] pub no_deps: bool, /// Automatically apply lint suggestions (see `cargo help clippy`) #[arg(long)] pub fix: bool, /// Arguments passed to rustc. #[arg(value_name = "args", trailing_var_arg = true, num_args = 0..)] pub args: Vec, } impl Clippy { /// Build a `cargo clippy` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("clippy"); self.common.apply(&mut cmd); self.check.apply(&mut cmd); if let Some(path) = self.manifest_path.as_ref() { cmd.arg("--manifest-path").arg(path); } if self.release { cmd.arg("--release"); } if self.ignore_rust_version { cmd.arg("--ignore-rust-version"); } if self.unit_graph { cmd.arg("--unit-graph"); } if self.no_deps { cmd.arg("--no-deps"); } if self.fix { cmd.arg("--fix"); } if !self.args.is_empty() { cmd.arg("--"); cmd.args(&self.args); } cmd } } impl Deref for Clippy { type Target = CommonOptions; fn deref(&self) -> &Self::Target { &self.common } } impl DerefMut for Clippy { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.common } } #[cfg(test)] mod test { use super::Clippy; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/src/common.rs000064400000000000000000000133011046102023000150430ustar 00000000000000use std::path::PathBuf; use std::process::Command; use crate::heading; use clap::{ArgAction, Parser}; /// common cargo options #[derive(Clone, Debug, Default, Parser)] pub struct CommonOptions { /// Do not print cargo log messages #[arg(short = 'q', long)] pub quiet: bool, /// Number of parallel jobs, defaults to # of CPUs #[arg( short = 'j', long, value_name = "N", help_heading = heading::COMPILATION_OPTIONS, )] pub jobs: Option, /// Do not abort the build as soon as there is an error (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub keep_going: bool, /// Build artifacts with the specified Cargo profile #[arg( long, value_name = "PROFILE-NAME", help_heading = heading::COMPILATION_OPTIONS, )] pub profile: Option, /// Space or comma separated list of features to activate #[arg( short = 'F', long, action = ArgAction::Append, help_heading = heading::FEATURE_SELECTION, )] pub features: Vec, /// Activate all available features #[arg(long, help_heading = heading::FEATURE_SELECTION)] pub all_features: bool, /// Do not activate the `default` feature #[arg(long, help_heading = heading::FEATURE_SELECTION)] pub no_default_features: bool, /// Build for the target triple #[arg( long, value_name = "TRIPLE", env = "CARGO_BUILD_TARGET", action = ArgAction::Append, help_heading = heading::COMPILATION_OPTIONS, )] pub target: Vec, /// Directory for all generated artifacts #[arg( long, value_name = "DIRECTORY", help_heading = heading::COMPILATION_OPTIONS, )] pub target_dir: Option, /// Error format #[arg(long, value_name = "FMT", action = ArgAction::Append)] pub message_format: Vec, /// Use verbose output (-vv very verbose/build.rs output) #[arg(short = 'v', long, action = ArgAction::Count)] pub verbose: u8, /// Coloring: auto, always, never #[arg(long, value_name = "WHEN")] pub color: Option, /// Require Cargo.lock and cache are up to date #[arg(long, help_heading = heading::MANIFEST_OPTIONS)] pub frozen: bool, /// Require Cargo.lock is up to date #[arg(long, help_heading = heading::MANIFEST_OPTIONS)] pub locked: bool, /// Run without accessing the network #[arg(long, help_heading = heading::MANIFEST_OPTIONS)] pub offline: bool, /// Override a configuration value (unstable) #[arg(long, value_name = "KEY=VALUE", action = ArgAction::Append)] pub config: Vec, /// Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details #[arg(short = 'Z', value_name = "FLAG", action = ArgAction::Append)] pub unstable_flags: Vec, /// Timing output formats (unstable) (comma separated): html, json #[arg( long, value_name = "FMTS", num_args = 0.., value_delimiter = ',', require_equals = true, help_heading = heading::COMPILATION_OPTIONS, )] pub timings: Option>, } impl CommonOptions { /// Apply options to `Command` pub fn apply(&self, cmd: &mut Command) { if self.quiet { cmd.arg("--quiet"); } if let Some(jobs) = self.jobs { cmd.arg("--jobs").arg(jobs.to_string()); } if self.keep_going { cmd.arg("--keep-going"); } if let Some(profile) = self.profile.as_ref() { cmd.arg("--profile").arg(profile); } for feature in &self.features { cmd.arg("--features").arg(feature); } if self.all_features { cmd.arg("--all-features"); } if self.no_default_features { cmd.arg("--no-default-features"); } // Support . syntax // For example: x86_64-unknown-linux-gnu.2.17 let rust_targets = self .target .iter() .map(|target| target.split_once('.').map(|(t, _)| t).unwrap_or(target)) .collect::>(); rust_targets.iter().for_each(|target| { cmd.arg("--target").arg(target); }); if let Some(dir) = self.target_dir.as_ref() { cmd.arg("--target-dir").arg(dir); } for fmt in &self.message_format { cmd.arg("--message-format").arg(fmt); } if self.verbose > 0 { cmd.arg(format!("-{}", "v".repeat(self.verbose.into()))); } if let Some(color) = self.color.as_ref() { cmd.arg("--color").arg(color); } if self.frozen { cmd.arg("--frozen"); } if self.locked { cmd.arg("--locked"); } if self.offline { cmd.arg("--offline"); } for config in &self.config { cmd.arg("--config").arg(config); } for flag in &self.unstable_flags { cmd.arg("-Z").arg(flag); } if let Some(timings) = &self.timings { if timings.is_empty() { cmd.arg("--timings"); } else { let timings: Vec<_> = timings.iter().map(|x| x.as_str()).collect(); cmd.arg(format!("--timings={}", timings.join(","))); } } } pub(crate) fn cargo_command() -> Command { let cargo = match std::env::var_os("CARGO") { Some(cargo) => cargo.into(), None => PathBuf::from("cargo"), }; let mut cmd = Command::new(cargo); cmd.env_remove("CARGO"); cmd } } cargo-options-0.7.4/src/doc.rs000064400000000000000000000116201046102023000143220ustar 00000000000000use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::process::Command; use clap::{ArgAction, Parser}; use crate::common::CommonOptions; use crate::heading; /// `cargo doc` options #[derive(Clone, Debug, Default, Parser)] pub struct DocOptions { /// Package to document #[arg( short = 'p', long = "package", value_name = "SPEC", action = ArgAction::Append, num_args=0..=1, help_heading = heading::PACKAGE_SELECTION, )] pub packages: Vec, /// Document all packages in the workspace #[arg(long, help_heading = heading::PACKAGE_SELECTION)] pub workspace: bool, /// Exclude packages from the build #[arg( long, value_name = "SPEC", action = ArgAction::Append, help_heading = heading::PACKAGE_SELECTION, )] pub exclude: Vec, /// Alias for --workspace (deprecated) #[arg(long, help_heading = heading::PACKAGE_SELECTION,)] pub all: bool, /// Document only this package's library #[arg(long, help_heading = heading::TARGET_SELECTION)] pub lib: bool, /// Document only the specified binary #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub bin: Vec, /// Document all binaries #[arg(long, help_heading = heading::TARGET_SELECTION)] pub bins: bool, /// Document only the specified example #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub example: Vec, /// Document all examples #[arg(long, help_heading = heading::TARGET_SELECTION)] pub examples: bool, /// Don't build documentation for dependencies #[arg(long)] pub no_deps: bool, /// Document private items #[arg(long)] pub document_private_items: bool, /// Opens the docs in a browser after the operation #[arg(long)] pub open: bool, } impl DocOptions { pub fn apply(&self, cmd: &mut Command) { for pkg in &self.packages { cmd.arg("--package").arg(pkg); } if self.workspace { cmd.arg("--workspace"); } for item in &self.exclude { cmd.arg("--exclude").arg(item); } if self.all { cmd.arg("--all"); } if self.lib { cmd.arg("--lib"); } for bin in &self.bin { cmd.arg("--bin").arg(bin); } if self.bins { cmd.arg("--bins"); } for example in &self.example { cmd.arg("--example").arg(example); } if self.examples { cmd.arg("--examples"); } if self.no_deps { cmd.arg("--no-deps"); } if self.document_private_items { cmd.arg("--document-private-items"); } if self.open { cmd.arg("--open"); } } } /// Build a package's documentation #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help doc` for more detailed information." )] #[group(skip)] pub struct Doc { #[command(flatten)] pub common: CommonOptions, #[command(flatten)] pub doc: DocOptions, /// Path to Cargo.toml #[arg(long, value_name = "PATH", help_heading = heading::MANIFEST_OPTIONS)] pub manifest_path: Option, /// Build artifacts in release mode, with optimizations #[arg(short = 'r', long, help_heading = heading::COMPILATION_OPTIONS)] pub release: bool, /// Ignore `rust-version` specification in packages #[arg(long)] pub ignore_rust_version: bool, /// Output build graph in JSON (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub unit_graph: bool, } impl Doc { /// Build a `cargo doc` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("doc"); self.common.apply(&mut cmd); self.doc.apply(&mut cmd); if let Some(path) = self.manifest_path.as_ref() { cmd.arg("--manifest-path").arg(path); } if self.release { cmd.arg("--release"); } if self.ignore_rust_version { cmd.arg("--ignore-rust-version"); } if self.unit_graph { cmd.arg("--unit-graph"); } cmd } } impl Deref for Doc { type Target = CommonOptions; fn deref(&self) -> &Self::Target { &self.common } } impl DerefMut for Doc { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.common } } #[cfg(test)] mod test { use super::Doc; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/src/install.rs000064400000000000000000000123211046102023000152220ustar 00000000000000use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::process::Command; use clap::{ArgAction, Parser}; use crate::common::CommonOptions; use crate::heading; /// Install a Rust binary. Default location is $HOME/.cargo/bin #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help install` for more detailed information." )] #[group(skip)] pub struct Install { #[command(flatten)] pub common: CommonOptions, /// Specify a version to install #[arg(long, value_name = "VERSION", alias = "vers", requires = "crates")] pub version: Option, /// Git URL to install the specified crate from #[arg(long, value_name = "URL", conflicts_with_all = ["path", "index", "registry"])] pub git: Option, /// Branch to use when installing from git #[arg(long, value_name = "BRANCH", requires = "git")] pub branch: Option, /// Tag to use when installing from git #[arg(long, value_name = "TAG", requires = "git")] pub tag: Option, /// Specific commit to use when installing from git #[arg(long, value_name = "SHA", requires = "git")] pub rev: Option, /// Filesystem path to local crate to install #[arg(long, value_name = "PATH", conflicts_with_all = ["git", "index", "registry"])] pub path: Option, /// list all installed packages and their versions #[arg(long)] pub list: bool, /// Force overwriting existing crates or binaries #[arg(short, long)] pub force: bool, /// Do not save tracking information #[arg(long)] pub no_track: bool, /// Build in debug mode (with the 'dev' profile) instead of release mode #[arg(long)] pub debug: bool, /// Directory to install packages into #[arg(long, value_name = "DIR")] pub root: Option, /// Registry index to install from #[arg( long, value_name = "INDEX", conflicts_with_all = ["git", "path", "registry"], requires = "crates", )] pub index: Option, /// Registry to use #[arg( long, value_name = "REGISTRY", conflicts_with_all = ["git", "path", "index"], requires = "crates", )] pub registry: Option, /// Install only the specified binary #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub bin: Vec, /// Install all binaries #[arg(long, help_heading = heading::TARGET_SELECTION)] pub bins: bool, /// Install only the specified example #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub example: Vec, /// Install all examples #[arg(long, help_heading = heading::TARGET_SELECTION)] pub examples: bool, #[arg(value_name = "crate", action = ArgAction::Append, num_args = 0..)] pub crates: Vec, } impl Install { /// Build a `cargo install` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("install"); self.common.apply(&mut cmd); if let Some(version) = self.version.as_ref() { cmd.arg("--version").arg(version); } if let Some(git) = self.git.as_ref() { cmd.arg("--git").arg(git); } if let Some(branch) = self.branch.as_ref() { cmd.arg("--branch").arg(branch); } if let Some(tag) = self.tag.as_ref() { cmd.arg("--tag").arg(tag); } if let Some(rev) = self.rev.as_ref() { cmd.arg("--rev").arg(rev); } if let Some(path) = self.path.as_ref() { cmd.arg("--path").arg(path); } if self.list { cmd.arg("--list"); } if self.force { cmd.arg("--force"); } if self.no_track { cmd.arg("--no-track"); } if self.debug { cmd.arg("--debug"); } if let Some(root) = self.root.as_ref() { cmd.arg("--root").arg(root); } if let Some(index) = self.index.as_ref() { cmd.arg("--index").arg(index); } if let Some(registry) = self.registry.as_ref() { cmd.arg("--registry").arg(registry); } for bin in &self.bin { cmd.arg("--bin").arg(bin); } if self.bins { cmd.arg("--bins"); } for example in &self.example { cmd.arg("--example").arg(example); } if self.examples { cmd.arg("--examples"); } cmd.args(&self.crates); cmd } } impl Deref for Install { type Target = CommonOptions; fn deref(&self) -> &Self::Target { &self.common } } impl DerefMut for Install { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.common } } #[cfg(test)] mod test { use super::Install; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/src/lib.rs000064400000000000000000000024661046102023000143330ustar 00000000000000mod build; mod check; mod clippy; mod common; mod doc; mod install; mod metadata; mod run; mod rustc; mod test; pub mod heading { pub const PACKAGE_SELECTION: &str = "Package Selection"; pub const TARGET_SELECTION: &str = "Target Selection"; pub const FEATURE_SELECTION: &str = "Feature Selection"; pub const COMPILATION_OPTIONS: &str = "Compilation Options"; pub const MANIFEST_OPTIONS: &str = "Manifest Options"; } pub fn styles() -> clap::builder::Styles { use anstyle::{AnsiColor, Effects}; clap::builder::styling::Styles::styled() .header(AnsiColor::Green.on_default().effects(Effects::BOLD)) .usage(AnsiColor::Green.on_default().effects(Effects::BOLD)) .literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD)) .placeholder(AnsiColor::Cyan.on_default()) .error(AnsiColor::Red.on_default().effects(Effects::BOLD)) .valid(AnsiColor::Cyan.on_default().effects(Effects::BOLD)) .invalid(AnsiColor::Yellow.on_default().effects(Effects::BOLD)) } // Specify crate to satisfy naming overlap w/ rustc clippy pub use crate::clippy::Clippy; pub use build::Build; pub use check::Check; pub use common::CommonOptions; pub use doc::Doc; pub use install::Install; pub use metadata::Metadata; pub use run::Run; pub use rustc::Rustc; pub use test::Test; cargo-options-0.7.4/src/metadata.rs000064400000000000000000000103741046102023000153420ustar 00000000000000use std::path::PathBuf; use std::process::Command; use clap::{ArgAction, Parser}; use crate::heading; use crate::CommonOptions; /// Output the resolved dependencies of a package, /// the concrete used versions including overrides, /// in machine-readable format #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help metadata` for more detailed information." )] #[group(skip)] pub struct Metadata { /// Do not print cargo log messages #[arg(short = 'q', long)] pub quiet: bool, /// Space or comma separated list of features to activate #[arg( short = 'F', long, action = ArgAction::Append, help_heading = heading::FEATURE_SELECTION, )] pub features: Vec, /// Activate all available features #[arg(long, help_heading = heading::FEATURE_SELECTION)] pub all_features: bool, /// Do not activate the `default` feature #[arg(long, help_heading = heading::FEATURE_SELECTION)] pub no_default_features: bool, /// Use verbose output (-vv very verbose/build.rs output) #[arg(short = 'v', long, action = ArgAction::Count)] pub verbose: u8, /// Only include resolve dependencies matching the given target-triple #[arg(long, value_name = "TRIPLE", action = ArgAction::Append)] pub filter_platform: Vec, /// Output information only about the workspace members /// and don't fetch dependencies #[arg(long)] pub no_deps: bool, /// Path to Cargo.toml #[arg(long, value_name = "PATH")] pub manifest_path: Option, /// Format version #[arg(long, value_name = "VERSION", value_parser = ["1"])] pub format_version: Option, /// Coloring: auto, always, never #[arg(long, value_name = "WHEN")] pub color: Option, /// Require Cargo.lock and cache are up to date #[arg(long, help_heading = heading::MANIFEST_OPTIONS)] pub frozen: bool, /// Require Cargo.lock is up to date #[arg(long, help_heading = heading::MANIFEST_OPTIONS)] pub locked: bool, /// Run without accessing the network #[arg(long, help_heading = heading::MANIFEST_OPTIONS)] pub offline: bool, /// Override a configuration value (unstable) #[arg(long, value_name = "KEY=VALUE", action = ArgAction::Append)] pub config: Vec, /// Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details #[arg(short = 'Z', value_name = "FLAG", action = ArgAction::Append)] pub unstable_flags: Vec, } impl Metadata { /// Build a `cargo metadata` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("metadata"); if self.quiet { cmd.arg("--quiet"); } if self.verbose > 0 { cmd.arg(format!("-{}", "v".repeat(self.verbose.into()))); } for feature in &self.features { cmd.arg("--features").arg(feature); } if self.all_features { cmd.arg("--all-features"); } if self.no_default_features { cmd.arg("--no-default-features"); } for platform in &self.filter_platform { cmd.arg("--filter-platform").arg(platform); } if self.no_deps { cmd.arg("--no-deps"); } if let Some(path) = self.manifest_path.as_ref() { cmd.arg("--manifest-path").arg(path); } if let Some(format_version) = self.format_version.as_ref() { cmd.arg("--format-version").arg(format_version); } if let Some(color) = self.color.as_ref() { cmd.arg("--color").arg(color); } if self.frozen { cmd.arg("--frozen"); } if self.locked { cmd.arg("--locked"); } if self.offline { cmd.arg("--offline"); } for config in &self.config { cmd.arg("--config").arg(config); } for flag in &self.unstable_flags { cmd.arg("-Z").arg(flag); } cmd } } #[cfg(test)] mod test { use super::Metadata; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/src/run.rs000064400000000000000000000063021046102023000143620ustar 00000000000000use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::process::Command; use clap::{ArgAction, Parser}; use crate::common::CommonOptions; use crate::heading; /// Run a binary or example of the local package #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help run` for more detailed information." )] #[group(skip)] pub struct Run { #[command(flatten)] pub common: CommonOptions, /// Path to Cargo.toml #[arg(long, value_name = "PATH", help_heading = heading::MANIFEST_OPTIONS)] pub manifest_path: Option, /// Build artifacts in release mode, with optimizations #[arg(short = 'r', long, help_heading = heading::COMPILATION_OPTIONS)] pub release: bool, /// Ignore `rust-version` specification in packages #[arg(long)] pub ignore_rust_version: bool, /// Output build graph in JSON (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub unit_graph: bool, /// Package to run (see `cargo help pkgid`) #[arg( short = 'p', long = "package", value_name = "SPEC", action = ArgAction::Append, num_args=0..=1, help_heading = heading::PACKAGE_SELECTION, )] pub packages: Vec, /// Run the specified binary #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub bin: Vec, /// Run the specified example #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub example: Vec, /// Arguments for the binary to run #[arg(value_name = "args", trailing_var_arg = true, num_args = 0..)] pub args: Vec, } impl Run { /// Build a `cargo run` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("run"); self.common.apply(&mut cmd); if let Some(path) = self.manifest_path.as_ref() { cmd.arg("--manifest-path").arg(path); } if self.release { cmd.arg("--release"); } if self.ignore_rust_version { cmd.arg("--ignore-rust-version"); } if self.unit_graph { cmd.arg("--unit-graph"); } for pkg in &self.packages { cmd.arg("--package").arg(pkg); } for bin in &self.bin { cmd.arg("--bin").arg(bin); } for example in &self.example { cmd.arg("--example").arg(example); } if !self.args.is_empty() { cmd.arg("--"); cmd.args(&self.args); } cmd } } impl Deref for Run { type Target = CommonOptions; fn deref(&self) -> &Self::Target { &self.common } } impl DerefMut for Run { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.common } } #[cfg(test)] mod test { use super::Run; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/src/rustc.rs000064400000000000000000000130731046102023000147210ustar 00000000000000use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::process::Command; use clap::{ArgAction, Parser}; use crate::common::CommonOptions; use crate::heading; /// Compile a package, and pass extra options to the compiler #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help rustc` for more detailed information." )] #[group(skip)] pub struct Rustc { #[command(flatten)] pub common: CommonOptions, /// Path to Cargo.toml #[arg(long, value_name = "PATH", help_heading = heading::MANIFEST_OPTIONS)] pub manifest_path: Option, /// Build artifacts in release mode, with optimizations #[arg(short = 'r', long, help_heading = heading::COMPILATION_OPTIONS)] pub release: bool, /// Ignore `rust-version` specification in packages #[arg(long)] pub ignore_rust_version: bool, /// Output build graph in JSON (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub unit_graph: bool, /// Package to build (see `cargo help pkgid`) #[arg( short = 'p', long = "package", value_name = "SPEC", action = ArgAction::Append, num_args=0..=1, help_heading = heading::PACKAGE_SELECTION, )] pub packages: Vec, /// Build only this package's library #[arg(long, help_heading = heading::TARGET_SELECTION)] pub lib: bool, /// Build only the specified binary #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub bin: Vec, /// Build all binaries #[arg(long)] pub bins: bool, /// Build only the specified example #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub example: Vec, /// Build all examples #[arg(long, help_heading = heading::TARGET_SELECTION)] pub examples: bool, /// Build only the specified test target #[arg( long, value_name = "NAME", action = ArgAction::Append, help_heading = heading::TARGET_SELECTION, )] pub test: Vec, /// Build all tests #[arg(long, help_heading = heading::TARGET_SELECTION)] pub tests: bool, /// Build only the specified bench target #[arg( long, value_name = "NAME", action = ArgAction::Append, help_heading = heading::TARGET_SELECTION, )] pub bench: Vec, /// Build all benches #[arg(long, help_heading = heading::TARGET_SELECTION)] pub benches: bool, /// Build all targets #[arg(long, help_heading = heading::TARGET_SELECTION)] pub all_targets: bool, /// Output compiler information without compiling #[arg(long, value_name = "INFO")] pub print: Option, /// Comma separated list of types of crates for the compiler to emit #[arg(long, value_name = "CRATE-TYPE", action = ArgAction::Append)] pub crate_type: Vec, /// Outputs a future incompatibility report at the end of the build (unstable) #[arg(long)] pub future_incompat_report: bool, /// Rustc flags #[arg(value_name = "args", trailing_var_arg = true, num_args = 0..)] pub args: Vec, } impl Rustc { /// Build a `cargo rustc` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("rustc"); self.common.apply(&mut cmd); if let Some(path) = self.manifest_path.as_ref() { cmd.arg("--manifest-path").arg(path); } if self.release { cmd.arg("--release"); } if self.ignore_rust_version { cmd.arg("--ignore-rust-version"); } if self.unit_graph { cmd.arg("--unit-graph"); } for pkg in &self.packages { cmd.arg("--package").arg(pkg); } if self.lib { cmd.arg("--lib"); } for bin in &self.bin { cmd.arg("--bin").arg(bin); } if self.bins { cmd.arg("--bins"); } for example in &self.example { cmd.arg("--example").arg(example); } if self.examples { cmd.arg("--examples"); } for test in &self.test { cmd.arg("--test").arg(test); } if self.tests { cmd.arg("--tests"); } for bench in &self.bench { cmd.arg("--bench").arg(bench); } if self.benches { cmd.arg("--benches"); } if self.all_targets { cmd.arg("--all-targets"); } if let Some(print) = self.print.as_ref() { cmd.arg("--print").arg(print); } if !self.crate_type.is_empty() { cmd.arg("--crate-type").arg(self.crate_type.join(",")); } if self.future_incompat_report { cmd.arg("--future-incompat-report"); } if !self.args.is_empty() { cmd.arg("--").args(&self.args); } cmd } } impl Deref for Rustc { type Target = CommonOptions; fn deref(&self) -> &Self::Target { &self.common } } impl DerefMut for Rustc { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.common } } #[cfg(test)] mod test { use super::Rustc; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/src/test.rs000064400000000000000000000147671046102023000145530ustar 00000000000000use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::process::Command; use clap::{ArgAction, Parser}; use crate::common::CommonOptions; use crate::heading; /// Execute all unit and integration tests and build examples of a local package #[derive(Clone, Debug, Default, Parser)] #[command( display_order = 1, after_help = "Run `cargo help test` for more detailed information.\nRun `cargo test -- --help` for test binary options." )] #[group(skip)] pub struct Test { #[command(flatten)] pub common: CommonOptions, /// Path to Cargo.toml #[arg(long, value_name = "PATH", help_heading = heading::MANIFEST_OPTIONS)] pub manifest_path: Option, /// Build artifacts in release mode, with optimizations #[arg(short = 'r', long, help_heading = heading::COMPILATION_OPTIONS)] pub release: bool, /// Ignore `rust-version` specification in packages #[arg(long)] pub ignore_rust_version: bool, /// Output build graph in JSON (unstable) #[arg(long, help_heading = heading::COMPILATION_OPTIONS)] pub unit_graph: bool, /// Package to build (see `cargo help pkgid`) #[arg( short = 'p', long = "package", value_name = "SPEC", action = ArgAction::Append, num_args=0..=1, help_heading = heading::PACKAGE_SELECTION, )] pub packages: Vec, /// Test all packages in the workspace #[arg(long, help_heading = heading::PACKAGE_SELECTION)] pub workspace: bool, /// Exclude packages from the build #[arg( long, value_name = "SPEC", action = ArgAction::Append, help_heading = heading::PACKAGE_SELECTION, )] pub exclude: Vec, /// Alias for workspace (deprecated) #[arg(long, help_heading = heading::PACKAGE_SELECTION)] pub all: bool, /// Test only this package's library #[arg(long, help_heading = heading::TARGET_SELECTION)] pub lib: bool, /// Test only the specified binary #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub bin: Vec, /// Test all binaries #[arg(long, help_heading = heading::TARGET_SELECTION)] pub bins: bool, /// Test only the specified example #[arg( long, value_name = "NAME", action = ArgAction::Append, num_args=0..=1, help_heading = heading::TARGET_SELECTION, )] pub example: Vec, /// Test all examples #[arg(long, help_heading = heading::TARGET_SELECTION)] pub examples: bool, /// Test only the specified test target #[arg( long, value_name = "NAME", action = ArgAction::Append, help_heading = heading::TARGET_SELECTION, )] pub test: Vec, /// Test all tests #[arg(long, help_heading = heading::TARGET_SELECTION)] pub tests: bool, /// Test only the specified bench target #[arg( long, value_name = "NAME", action = ArgAction::Append, help_heading = heading::TARGET_SELECTION, )] pub bench: Vec, /// Test all benches #[arg(long, help_heading = heading::TARGET_SELECTION)] pub benches: bool, /// Test all targets #[arg(long, help_heading = heading::TARGET_SELECTION)] pub all_targets: bool, /// Test only this library's documentation #[arg(long)] pub doc: bool, /// Compile, but don't run tests #[arg(long)] pub no_run: bool, /// Run all tests regardless of failure #[arg(long)] pub no_fail_fast: bool, /// Outputs a future incompatibility report at the end of the build (unstable) #[arg(long)] pub future_incompat_report: bool, /// If specified, only run tests containing this string in their names #[arg(value_name = "TESTNAME")] pub test_name: Option, /// Arguments for the test binary #[arg(value_name = "args", trailing_var_arg = true, num_args = 0..)] pub args: Vec, } impl Test { /// Build a `cargo test` command pub fn command(&self) -> Command { let mut cmd = CommonOptions::cargo_command(); cmd.arg("test"); self.common.apply(&mut cmd); if let Some(path) = self.manifest_path.as_ref() { cmd.arg("--manifest-path").arg(path); } if self.release { cmd.arg("--release"); } if self.ignore_rust_version { cmd.arg("--ignore-rust-version"); } if self.unit_graph { cmd.arg("--unit-graph"); } for pkg in &self.packages { cmd.arg("--package").arg(pkg); } if self.workspace { cmd.arg("--workspace"); } for item in &self.exclude { cmd.arg("--exclude").arg(item); } if self.all { cmd.arg("--all"); } if self.lib { cmd.arg("--lib"); } for bin in &self.bin { cmd.arg("--bin").arg(bin); } if self.bins { cmd.arg("--bins"); } for example in &self.example { cmd.arg("--example").arg(example); } if self.examples { cmd.arg("--examples"); } for test in &self.test { cmd.arg("--test").arg(test); } if self.tests { cmd.arg("--tests"); } for bench in &self.bench { cmd.arg("--bench").arg(bench); } if self.benches { cmd.arg("--benches"); } if self.all_targets { cmd.arg("--all-targets"); } if self.doc { cmd.arg("--doc"); } if self.no_run { cmd.arg("--no-run"); } if self.no_fail_fast { cmd.arg("--no-fail-fast"); } if self.future_incompat_report { cmd.arg("--future-incompat-report"); } cmd.arg("--"); if let Some(test_name) = self.test_name.as_ref() { cmd.arg(test_name); } cmd.args(&self.args); cmd } } impl Deref for Test { type Target = CommonOptions; fn deref(&self) -> &Self::Target { &self.common } } impl DerefMut for Test { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.common } } #[cfg(test)] mod tests { use super::Test; use clap::CommandFactory; #[test] fn verify_cli() { ::command().debug_assert() } } cargo-options-0.7.4/tests/cli_tests.rs000064400000000000000000000002441046102023000161210ustar 00000000000000#[test] fn cli_tests() { let t = trycmd::TestCases::new(); t.register_bins(trycmd::cargo::compile_examples([]).unwrap()); t.case("tests/cmd/*.toml"); } cargo-options-0.7.4/tests/cmd/build.stderr000064400000000000000000000000001046102023000166370ustar 00000000000000cargo-options-0.7.4/tests/cmd/build.stdout000064400000000000000000000057331046102023000167000ustar 00000000000000Compile a local package and all of its dependencies Usage: cargo-mimic[EXE] build [OPTIONS] Options: -q, --quiet Do not print cargo log messages --message-format Error format -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details --ignore-rust-version Ignore `rust-version` specification in packages --future-incompat-report Outputs a future incompatibility report at the end of the build (unstable) -h, --help Print help Compilation Options: -j, --jobs Number of parallel jobs, defaults to # of CPUs --keep-going Do not abort the build as soon as there is an error (unstable) --profile Build artifacts with the specified Cargo profile --target Build for the target triple [env: CARGO_BUILD_TARGET=] --target-dir Directory for all generated artifacts --timings[=...] Timing output formats (unstable) (comma separated): html, json -r, --release Build artifacts in release mode, with optimizations --unit-graph Output build graph in JSON (unstable) --out-dir Copy final artifacts to this directory (unstable) --build-plan Output the build plan in JSON (unstable) Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network --manifest-path Path to Cargo.toml Package Selection: -p, --package [] Package to build (see `cargo help pkgid`) --workspace Build all packages in the workspace --exclude Exclude packages from the build --all Alias for workspace (deprecated) Target Selection: --lib Build only this package's library --bin [] Build only the specified binary --bins Build all binaries --example [] Build only the specified example --examples Build all examples --test Build only the specified test target --tests Build all tests --bench Build only the specified bench target --benches Build all benches --all-targets Build all targets Run `cargo help build` for more detailed information. cargo-options-0.7.4/tests/cmd/build.toml000064400000000000000000000000571046102023000163230ustar 00000000000000bin.name = "cargo-mimic" args = "build --help" cargo-options-0.7.4/tests/cmd/check.stderr000064400000000000000000000000001046102023000166150ustar 00000000000000cargo-options-0.7.4/tests/cmd/check.stdout000064400000000000000000000055111046102023000166500ustar 00000000000000Check a local package and all of its dependencies for errors Usage: cargo-mimic[EXE] check [OPTIONS] Options: -q, --quiet Do not print cargo log messages --message-format Error format -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details --future-incompat-report Outputs a future incompatibility report at the end of the build (unstable) --ignore-rust-version Ignore `rust-version` specification in packages -h, --help Print help Compilation Options: -j, --jobs Number of parallel jobs, defaults to # of CPUs --keep-going Do not abort the build as soon as there is an error (unstable) --profile Build artifacts with the specified Cargo profile --target Build for the target triple [env: CARGO_BUILD_TARGET=] --target-dir Directory for all generated artifacts --timings[=...] Timing output formats (unstable) (comma separated): html, json -r, --release Build artifacts in release mode, with optimizations --unit-graph Output build graph in JSON (unstable) Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network --manifest-path Path to Cargo.toml Package Selection: -p, --package [] Package to build (see `cargo help pkgid`) --workspace Check all packages in the workspace --exclude Exclude packages from the build --all Alias for workspace (deprecated) Target Selection: --lib Check only this package's library --bin [] Check only the specified binary --bins Check all binaries --example [] Check only the specified example --examples Check all examples --test Check only the specified test target --tests Check all tests --bench Check only the specified bench target --benches Check all benches --all-targets Check all targets Run `cargo help check` for more detailed information. cargo-options-0.7.4/tests/cmd/check.toml000064400000000000000000000000571046102023000163010ustar 00000000000000bin.name = "cargo-mimic" args = "check --help" cargo-options-0.7.4/tests/cmd/clippy.stderr000064400000000000000000000000001046102023000170400ustar 00000000000000cargo-options-0.7.4/tests/cmd/clippy.stdout000064400000000000000000000060661046102023000171010ustar 00000000000000Checks a package to catch common mistakes and improve your Rust code Usage: cargo-mimic[EXE] clippy [OPTIONS] [args]... Arguments: [args]... Arguments passed to rustc Options: -q, --quiet Do not print cargo log messages --message-format Error format -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details --future-incompat-report Outputs a future incompatibility report at the end of the build (unstable) --ignore-rust-version Ignore `rust-version` specification in packages --no-deps Ignore dependencies, run only on crate --fix Automatically apply lint suggestions (see `cargo help clippy`) -h, --help Print help Compilation Options: -j, --jobs Number of parallel jobs, defaults to # of CPUs --keep-going Do not abort the build as soon as there is an error (unstable) --profile Build artifacts with the specified Cargo profile --target Build for the target triple [env: CARGO_BUILD_TARGET=] --target-dir Directory for all generated artifacts --timings[=...] Timing output formats (unstable) (comma separated): html, json -r, --release Build artifacts in release mode, with optimizations --unit-graph Output build graph in JSON (unstable) Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network --manifest-path Path to Cargo.toml Package Selection: -p, --package [] Package to build (see `cargo help pkgid`) --workspace Check all packages in the workspace --exclude Exclude packages from the build --all Alias for workspace (deprecated) Target Selection: --lib Check only this package's library --bin [] Check only the specified binary --bins Check all binaries --example [] Check only the specified example --examples Check all examples --test Check only the specified test target --tests Check all tests --bench Check only the specified bench target --benches Check all benches --all-targets Check all targets Run `cargo help clippy` for more detailed information. cargo-options-0.7.4/tests/cmd/clippy.toml000064400000000000000000000000601046102023000165160ustar 00000000000000bin.name = "cargo-mimic" args = "clippy --help" cargo-options-0.7.4/tests/cmd/doc.stderr000064400000000000000000000000001046102023000163050ustar 00000000000000cargo-options-0.7.4/tests/cmd/doc.stdout000064400000000000000000000051541046102023000163430ustar 00000000000000Build a package's documentation Usage: cargo-mimic[EXE] doc [OPTIONS] Options: -q, --quiet Do not print cargo log messages --message-format Error format -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details --no-deps Don't build documentation for dependencies --document-private-items Document private items --open Opens the docs in a browser after the operation --ignore-rust-version Ignore `rust-version` specification in packages -h, --help Print help Compilation Options: -j, --jobs Number of parallel jobs, defaults to # of CPUs --keep-going Do not abort the build as soon as there is an error (unstable) --profile Build artifacts with the specified Cargo profile --target Build for the target triple [env: CARGO_BUILD_TARGET=] --target-dir Directory for all generated artifacts --timings[=...] Timing output formats (unstable) (comma separated): html, json -r, --release Build artifacts in release mode, with optimizations --unit-graph Output build graph in JSON (unstable) Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network --manifest-path Path to Cargo.toml Package Selection: -p, --package [] Package to document --workspace Document all packages in the workspace --exclude Exclude packages from the build --all Alias for --workspace (deprecated) Target Selection: --lib Document only this package's library --bin [] Document only the specified binary --bins Document all binaries --example [] Document only the specified example --examples Document all examples Run `cargo help doc` for more detailed information. cargo-options-0.7.4/tests/cmd/doc.toml000064400000000000000000000000551046102023000157670ustar 00000000000000bin.name = "cargo-mimic" args = "doc --help" cargo-options-0.7.4/tests/cmd/install.stderr000064400000000000000000000000001046102023000172060ustar 00000000000000cargo-options-0.7.4/tests/cmd/install.stdout000064400000000000000000000053361046102023000172460ustar 00000000000000Install a Rust binary. Default location is $HOME/.cargo/bin Usage: cargo-mimic[EXE] install [OPTIONS] [crate]... Arguments: [crate]... Options: -q, --quiet Do not print cargo log messages --message-format Error format -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details --version Specify a version to install --git Git URL to install the specified crate from --branch Branch to use when installing from git --tag Tag to use when installing from git --rev Specific commit to use when installing from git --path Filesystem path to local crate to install --list list all installed packages and their versions -f, --force Force overwriting existing crates or binaries --no-track Do not save tracking information --debug Build in debug mode (with the 'dev' profile) instead of release mode --root Directory to install packages into --index Registry index to install from --registry Registry to use -h, --help Print help Compilation Options: -j, --jobs Number of parallel jobs, defaults to # of CPUs --keep-going Do not abort the build as soon as there is an error (unstable) --profile Build artifacts with the specified Cargo profile --target Build for the target triple [env: CARGO_BUILD_TARGET=] --target-dir Directory for all generated artifacts --timings[=...] Timing output formats (unstable) (comma separated): html, json Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network Target Selection: --bin [] Install only the specified binary --bins Install all binaries --example [] Install only the specified example --examples Install all examples Run `cargo help install` for more detailed information. cargo-options-0.7.4/tests/cmd/install.toml000064400000000000000000000000611046102023000166650ustar 00000000000000bin.name = "cargo-mimic" args = "install --help" cargo-options-0.7.4/tests/cmd/metadata.stderr000064400000000000000000000000001046102023000173200ustar 00000000000000cargo-options-0.7.4/tests/cmd/metadata.stdout000064400000000000000000000027321046102023000173550ustar 00000000000000Output the resolved dependencies of a package, the concrete used versions including overrides, in machine-readable format Usage: cargo-mimic[EXE] metadata [OPTIONS] Options: -q, --quiet Do not print cargo log messages -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --filter-platform Only include resolve dependencies matching the given target-triple --no-deps Output information only about the workspace members and don't fetch dependencies --manifest-path Path to Cargo.toml --format-version Format version [possible values: 1] --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details -h, --help Print help Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network Run `cargo help metadata` for more detailed information. cargo-options-0.7.4/tests/cmd/metadata.toml000064400000000000000000000000621046102023000170000ustar 00000000000000bin.name = "cargo-mimic" args = "metadata --help" cargo-options-0.7.4/tests/cmd/run.stderr000064400000000000000000000000001046102023000163440ustar 00000000000000cargo-options-0.7.4/tests/cmd/run.stdout000064400000000000000000000042011046102023000163720ustar 00000000000000Run a binary or example of the local package Usage: cargo-mimic[EXE] run [OPTIONS] [args]... Arguments: [args]... Arguments for the binary to run Options: -q, --quiet Do not print cargo log messages --message-format Error format -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details --ignore-rust-version Ignore `rust-version` specification in packages -h, --help Print help Compilation Options: -j, --jobs Number of parallel jobs, defaults to # of CPUs --keep-going Do not abort the build as soon as there is an error (unstable) --profile Build artifacts with the specified Cargo profile --target Build for the target triple [env: CARGO_BUILD_TARGET=] --target-dir Directory for all generated artifacts --timings[=...] Timing output formats (unstable) (comma separated): html, json -r, --release Build artifacts in release mode, with optimizations --unit-graph Output build graph in JSON (unstable) Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network --manifest-path Path to Cargo.toml Package Selection: -p, --package [] Package to run (see `cargo help pkgid`) Target Selection: --bin [] Run the specified binary --example [] Run the specified example Run `cargo help run` for more detailed information. cargo-options-0.7.4/tests/cmd/run.toml000064400000000000000000000000551046102023000160260ustar 00000000000000bin.name = "cargo-mimic" args = "run --help" cargo-options-0.7.4/tests/cmd/rustc.stderr000064400000000000000000000000001046102023000167000ustar 00000000000000cargo-options-0.7.4/tests/cmd/rustc.stdout000064400000000000000000000056051046102023000167370ustar 00000000000000Compile a package, and pass extra options to the compiler Usage: cargo-mimic[EXE] rustc [OPTIONS] [args]... Arguments: [args]... Rustc flags Options: -q, --quiet Do not print cargo log messages --message-format Error format -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details --ignore-rust-version Ignore `rust-version` specification in packages --bins Build all binaries --print Output compiler information without compiling --crate-type Comma separated list of types of crates for the compiler to emit --future-incompat-report Outputs a future incompatibility report at the end of the build (unstable) -h, --help Print help Compilation Options: -j, --jobs Number of parallel jobs, defaults to # of CPUs --keep-going Do not abort the build as soon as there is an error (unstable) --profile Build artifacts with the specified Cargo profile --target Build for the target triple [env: CARGO_BUILD_TARGET=] --target-dir Directory for all generated artifacts --timings[=...] Timing output formats (unstable) (comma separated): html, json -r, --release Build artifacts in release mode, with optimizations --unit-graph Output build graph in JSON (unstable) Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network --manifest-path Path to Cargo.toml Package Selection: -p, --package [] Package to build (see `cargo help pkgid`) Target Selection: --lib Build only this package's library --bin [] Build only the specified binary --example [] Build only the specified example --examples Build all examples --test Build only the specified test target --tests Build all tests --bench Build only the specified bench target --benches Build all benches --all-targets Build all targets Run `cargo help rustc` for more detailed information. cargo-options-0.7.4/tests/cmd/rustc.toml000064400000000000000000000000571046102023000163640ustar 00000000000000bin.name = "cargo-mimic" args = "rustc --help" cargo-options-0.7.4/tests/cmd/test.stderr000064400000000000000000000000001046102023000165170ustar 00000000000000cargo-options-0.7.4/tests/cmd/test.stdout000064400000000000000000000063461046102023000165610ustar 00000000000000Execute all unit and integration tests and build examples of a local package Usage: cargo-mimic[EXE] test [OPTIONS] [TESTNAME] [args]... Arguments: [TESTNAME] If specified, only run tests containing this string in their names [args]... Arguments for the test binary Options: -q, --quiet Do not print cargo log messages --message-format Error format -v, --verbose... Use verbose output (-vv very verbose/build.rs output) --color Coloring: auto, always, never --config Override a configuration value (unstable) -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details --ignore-rust-version Ignore `rust-version` specification in packages --doc Test only this library's documentation --no-run Compile, but don't run tests --no-fail-fast Run all tests regardless of failure --future-incompat-report Outputs a future incompatibility report at the end of the build (unstable) -h, --help Print help Compilation Options: -j, --jobs Number of parallel jobs, defaults to # of CPUs --keep-going Do not abort the build as soon as there is an error (unstable) --profile Build artifacts with the specified Cargo profile --target Build for the target triple [env: CARGO_BUILD_TARGET=] --target-dir Directory for all generated artifacts --timings[=...] Timing output formats (unstable) (comma separated): html, json -r, --release Build artifacts in release mode, with optimizations --unit-graph Output build graph in JSON (unstable) Feature Selection: -F, --features Space or comma separated list of features to activate --all-features Activate all available features --no-default-features Do not activate the `default` feature Manifest Options: --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date --offline Run without accessing the network --manifest-path Path to Cargo.toml Package Selection: -p, --package [] Package to build (see `cargo help pkgid`) --workspace Test all packages in the workspace --exclude Exclude packages from the build --all Alias for workspace (deprecated) Target Selection: --lib Test only this package's library --bin [] Test only the specified binary --bins Test all binaries --example [] Test only the specified example --examples Test all examples --test Test only the specified test target --tests Test all tests --bench Test only the specified bench target --benches Test all benches --all-targets Test all targets Run `cargo help test` for more detailed information. Run `cargo test -- --help` for test binary options. cargo-options-0.7.4/tests/cmd/test.toml000064400000000000000000000000561046102023000162020ustar 00000000000000bin.name = "cargo-mimic" args = "test --help"