mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-05 02:55:31 +00:00
feat: generate man pages with clap_mangen
This commit is contained in:
parent
398a619018
commit
5d27a0cd0b
23
.github/workflows/build-and-test.yml
vendored
23
.github/workflows/build-and-test.yml
vendored
@ -43,8 +43,8 @@ jobs:
|
||||
rustup toolchain install nightly --profile minimal -t ${{ matrix.target }}
|
||||
cargo +nightly build --release --target ${{ matrix.target }}
|
||||
env:
|
||||
GEN_COMPLETIONS: 1
|
||||
RUSTFLAGS: -Z strip=symbols
|
||||
OUCH_ARTIFACTS_FOLDER: artifacts
|
||||
RUSTFLAGS: -C strip=symbols
|
||||
|
||||
- name: Upload bianry
|
||||
uses: actions/upload-artifact@v2
|
||||
@ -52,25 +52,12 @@ jobs:
|
||||
name: ouch-${{ matrix.target }}${{ matrix.ext }}
|
||||
path: target/${{ matrix.target }}/release/ouch${{ matrix.ext }}
|
||||
|
||||
- name: Build man page and find completions (musl)
|
||||
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
|
||||
run: |
|
||||
help2man target/${{ matrix.target }}/release/ouch > ouch.1
|
||||
cp -r target/${{ matrix.target }}/release/build/ouch-*/out/completions .
|
||||
|
||||
- name: Upload completions (musl)
|
||||
- name: Upload artifacts (musl)
|
||||
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: completions
|
||||
path: completions
|
||||
|
||||
- name: Upload man page (musl)
|
||||
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ouch.1
|
||||
path: ouch.1
|
||||
name: artifacts
|
||||
path: artifacts
|
||||
|
||||
clippy-rustfmt:
|
||||
name: clippy-rustfmt
|
||||
|
249
Cargo.lock
generated
249
Cargo.lock
generated
@ -10,9 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
version = "0.7.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@ -50,9 +50,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de"
|
||||
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
|
||||
dependencies = [
|
||||
"bit-vec",
|
||||
]
|
||||
@ -118,9 +118,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cfb"
|
||||
version = "0.7.0"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25f6cc832d96f9961bfe67da666f1fb96387305d385db5222cbb7bce21121016"
|
||||
checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"fnv",
|
||||
@ -135,35 +135,33 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.1.18"
|
||||
version = "4.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b"
|
||||
checksum = "30607dd93c420c6f1f80b544be522a0238a7db35e6a12968d28910983fee0df0"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
"clap_derive",
|
||||
"clap_lex",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
"textwrap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete"
|
||||
version = "3.1.4"
|
||||
version = "4.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da92e6facd8d73c22745a5d3cbb59bdf8e46e3235c923e516527d8e81eec14a4"
|
||||
checksum = "11cba7abac9b56dfe2f035098cdb3a43946f276e6db83b72c4e692343f9aab9a"
|
||||
dependencies = [
|
||||
"clap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "3.1.18"
|
||||
version = "4.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c"
|
||||
checksum = "a4a307492e1a34939f79d3b6b9650bd2b971513cd775436bf2b78defeb5af00b"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
@ -174,22 +172,32 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213"
|
||||
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
|
||||
dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.15.0"
|
||||
name = "clap_mangen"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31"
|
||||
checksum = "d5d5cd261a1d5601621a7ee4870f6e7f3f1ba3fc901d867f5201b36691e7efbe"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"roff",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"terminal_size",
|
||||
"winapi",
|
||||
]
|
||||
@ -205,12 +213,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.8"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
|
||||
checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -227,9 +234,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.6.1"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
@ -239,23 +246,23 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.7.0"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
|
||||
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.16"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c"
|
||||
checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"winapi",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -277,15 +284,15 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "fs-err"
|
||||
version = "2.7.0"
|
||||
version = "2.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bd79fa345a495d3ae89fb7165fec01c0e72f41821d642dda363a1e97975652e"
|
||||
checksum = "64db3e262960f0662f43a6366788d5f10f7f244b8f7d7d987f560baf5ded5c50"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
|
||||
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
@ -294,9 +301,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.8"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd"
|
||||
checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
@ -305,12 +312,6 @@ dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.0"
|
||||
@ -344,16 +345,6 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indicatif"
|
||||
version = "0.16.2"
|
||||
@ -368,9 +359,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "infer"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16f98856089d7ef1e861afada561bc23897918cfdfda49fe4f90ae9152ac86c3"
|
||||
checksum = "f178e61cdbfe084aa75a2f4f7a25a5bb09701a47ae1753608f194b15783c937a"
|
||||
dependencies = [
|
||||
"cfb",
|
||||
]
|
||||
@ -395,18 +386,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.3"
|
||||
version = "0.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
|
||||
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.24"
|
||||
version = "0.1.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
|
||||
checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@ -419,9 +410,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.126"
|
||||
version = "0.2.134"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb"
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
@ -436,9 +427,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.4"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
||||
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
@ -451,9 +442,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lzma-sys"
|
||||
version = "0.1.17"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdb4b7c3eddad11d3af9e86c487607d2d2442d185d848575365c4856ba96d619"
|
||||
checksum = "e06754c4acf47d49c727d5665ca9fb828851cda315ed3bd51edd148ef78a8772"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@ -477,9 +468,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.5.3"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc"
|
||||
checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
@ -510,15 +501,15 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.12.0"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
|
||||
checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.1.0"
|
||||
version = "6.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
|
||||
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
|
||||
|
||||
[[package]]
|
||||
name = "ouch"
|
||||
@ -529,6 +520,7 @@ dependencies = [
|
||||
"bzip2",
|
||||
"clap",
|
||||
"clap_complete",
|
||||
"clap_mangen",
|
||||
"flate2",
|
||||
"fs-err",
|
||||
"ignore",
|
||||
@ -554,9 +546,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parse-display"
|
||||
version = "0.5.5"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "813e91c6232dbeb2e9deba0eb0dc5c967bd6f380676fd34419f9ddd71411faa7"
|
||||
checksum = "3b25af4ef94a8528b41fb49a696e361dc6ef975c782417268072d987ac327964"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"parse-display-derive",
|
||||
@ -565,9 +557,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parse-display-derive"
|
||||
version = "0.5.5"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "007ed61a69cf7d9b95cc5dc18489dbb4f70d4adb0a0c100e2dd46f0be241711a"
|
||||
checksum = "73f106cced1f4b645e3fca6125105cdf7407e35d1af710f290aac530f6b826b9"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
@ -643,9 +635,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.39"
|
||||
version = "1.0.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
|
||||
checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -684,9 +676,9 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.18"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
|
||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -714,9 +706,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.3"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
@ -732,18 +724,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.13"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.6"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
|
||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@ -758,9 +750,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.26"
|
||||
version = "0.6.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
|
||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
@ -771,6 +763,12 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "roff"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316"
|
||||
|
||||
[[package]]
|
||||
name = "rusty-fork"
|
||||
version = "0.3.0"
|
||||
@ -829,9 +827,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.95"
|
||||
version = "1.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942"
|
||||
checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -890,9 +888,9 @@ checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b"
|
||||
|
||||
[[package]]
|
||||
name = "test-strategy"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c18b325ca048e49683d5cb9166a50191fc862e36020706bbd7723c22a05d4ffa"
|
||||
checksum = "62d6408d1406657be2f9d1701fbae379331d30d2f6e92050710edb0d34eeb480"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -900,12 +898,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.4"
|
||||
@ -917,9 +909,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.9"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd"
|
||||
checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"num_threads",
|
||||
@ -927,15 +919,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.0"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
|
||||
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.1.0"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93bbc61e655a4833cf400d0d15bf3649313422fa7572886ad6dab16d79886365"
|
||||
checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
@ -971,9 +963,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
@ -1006,6 +998,49 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||
dependencies = [
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||
|
||||
[[package]]
|
||||
name = "xattr"
|
||||
version = "0.2.3"
|
||||
@ -1017,9 +1052,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "xz2"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c179869f34fc7c01830d3ce7ea2086bc3a07e0d35289b667d0a8bf910258926c"
|
||||
checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
|
||||
dependencies = [
|
||||
"lzma-sys",
|
||||
]
|
||||
|
25
Cargo.toml
25
Cargo.toml
@ -15,16 +15,16 @@ description = "A command-line utility for easily compressing and decompressing f
|
||||
[dependencies]
|
||||
atty = "0.2.14"
|
||||
bzip2 = "0.4.3"
|
||||
clap = { version = "3.1.18", features = ["derive", "env"] }
|
||||
clap = { version = "4.0.9", features = ["derive", "env"] }
|
||||
flate2 = { version = "1.0.24", default-features = false }
|
||||
fs-err = "2.7.0"
|
||||
libc = "0.2.126"
|
||||
linked-hash-map = "0.5.4"
|
||||
fs-err = "2.8.1"
|
||||
libc = "0.2.134"
|
||||
linked-hash-map = "0.5.6"
|
||||
lzzzz = "1.0.3"
|
||||
once_cell = "1.12.0"
|
||||
once_cell = "1.15.0"
|
||||
snap = "1.0.5"
|
||||
tar = "0.4.38"
|
||||
xz2 = "0.1.6"
|
||||
xz2 = "0.1.7"
|
||||
zip = { version = "0.6.2", default-features = false }
|
||||
zstd = { version = "0.11.2", default-features = false }
|
||||
tempfile = "3.3.0"
|
||||
@ -32,22 +32,23 @@ ignore = "0.4.18"
|
||||
indicatif = "0.16.2"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
time = { version = "0.3.9", default-features = false }
|
||||
time = { version = "0.3.14", default-features = false }
|
||||
|
||||
[target.'cfg(not(unix))'.dependencies]
|
||||
is_executable = "1.0.1"
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "3.1.18", features = ["derive", "env"] }
|
||||
clap_complete = "3.1.4"
|
||||
clap = { version = "4.0.9", features = ["derive", "env", "string"] }
|
||||
clap_complete = "4.0.2"
|
||||
clap_mangen = "0.2.2"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd = "2.0.4"
|
||||
infer = "0.8.0"
|
||||
parse-display = "0.5.5"
|
||||
infer = "0.9.0"
|
||||
parse-display = "0.6.0"
|
||||
proptest = "1.0.0"
|
||||
rand = { version = "0.8.5", default-features = false, features = ["small_rng", "std"] }
|
||||
test-strategy = "0.2.0"
|
||||
test-strategy = "0.2.1"
|
||||
|
||||
[features]
|
||||
default = ["flate2/zlib", "zip/deflate-zlib", "zstd/thin"]
|
||||
|
101
build.rs
101
build.rs
@ -1,96 +1,55 @@
|
||||
/// This build script checks for env vars to build ouch with shell completions.
|
||||
/// This build script checks for env vars to build ouch with shell completions and man pages.
|
||||
///
|
||||
/// # How to generate shell completions:
|
||||
/// # How to generate shell completions and man pages:
|
||||
///
|
||||
/// Set `OUCH_COMPLETIONS_FOLDER` to the name of the destination folder:
|
||||
/// Set `OUCH_ARTIFACTS_FOLDER` to the name of the destination folder:
|
||||
///
|
||||
/// ```sh
|
||||
/// OUCH_COMPLETIONS_FOLDER=my-folder cargo build
|
||||
/// OUCH_ARTIFACTS_FOLDER=my-folder cargo build
|
||||
/// ```
|
||||
///
|
||||
/// All completion files will be generated inside of the folder "my-folder".
|
||||
///
|
||||
/// If the folder does not exist, it will be created.
|
||||
///
|
||||
/// We recommend you naming this folder "completions" for the sake of consistency.
|
||||
/// We recommend you naming this folder "artifacts" for the sake of consistency.
|
||||
///
|
||||
/// ```sh
|
||||
/// OUCH_COMPLETIONS_FOLDER=completions cargo build
|
||||
/// OUCH_ARTIFACTS_FOLDER=artifacts cargo build
|
||||
/// ```
|
||||
///
|
||||
/// # Retrocompatibility
|
||||
///
|
||||
/// The old method that still works so it does not break older packages.
|
||||
///
|
||||
/// Using `GEN_COMPLETIONS=1` still works for those packages who need it,
|
||||
/// however.
|
||||
///
|
||||
/// ```sh
|
||||
/// GEN_COMPLETIONS=1 cargo build
|
||||
/// ```
|
||||
///
|
||||
/// Will generate completions to a cargo target default folder, for example:
|
||||
/// - `target/debug/build/ouch-195b34a8adca6ec3/out/completions`
|
||||
///
|
||||
/// The _"195b34a8adca6ec3"_ part is a hash that might change between runs.
|
||||
use std::{env, fs, path::Path};
|
||||
use std::{
|
||||
env,
|
||||
fs::{create_dir_all, File},
|
||||
path::Path,
|
||||
};
|
||||
|
||||
use clap::IntoApp;
|
||||
use clap::{CommandFactory, ValueEnum};
|
||||
use clap_complete::{generate_to, Shell};
|
||||
|
||||
const TARGET_SHELLS: &[Shell] = &[Shell::Bash, Shell::Zsh, Shell::Fish];
|
||||
use clap_mangen::Man;
|
||||
|
||||
include!("src/opts.rs");
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-env-changed=GEN_COMPLETIONS");
|
||||
println!("cargo:rerun-if-env-changed=OUCH_COMPLETIONS_FOLDER");
|
||||
println!("cargo:rerun-if-env-changed=OUCH_ARTIFACTS_FOLDER");
|
||||
|
||||
let completions_output_directory = match detect_completions_output_directory() {
|
||||
Some(inner) => inner,
|
||||
_ => return,
|
||||
};
|
||||
if let Some(dir) = env::var_os("OUCH_ARTIFACTS_FOLDER") {
|
||||
let out = &Path::new(&dir);
|
||||
create_dir_all(out).unwrap();
|
||||
let cmd = &mut Opts::command();
|
||||
|
||||
fs::create_dir_all(&completions_output_directory).expect("Could not create shell completions output folder.");
|
||||
Man::new(cmd.clone())
|
||||
.render(&mut File::create(out.join("ouch.1")).unwrap())
|
||||
.unwrap();
|
||||
|
||||
let app = &mut Opts::command();
|
||||
for subcmd in cmd.get_subcommands() {
|
||||
let name = format!("ouch-{}", subcmd.get_name());
|
||||
Man::new(subcmd.clone().name(&name))
|
||||
.render(&mut File::create(out.join(format!("{name}.1"))).unwrap())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
for shell in TARGET_SHELLS {
|
||||
let target_directory = if env::var_os("OUCH_COMPLETIONS_FOLDER").is_some() {
|
||||
let shell_name = shell.to_string();
|
||||
|
||||
let shell_dir = completions_output_directory.join(&shell_name);
|
||||
fs::create_dir(&shell_dir).expect("Failed to create directory for shell completions");
|
||||
|
||||
shell_dir
|
||||
} else {
|
||||
completions_output_directory.clone()
|
||||
};
|
||||
generate_to(*shell, app, "ouch", &target_directory)
|
||||
.unwrap_or_else(|err| panic!("Failed to generate shell completions for {}: {}.", shell, err));
|
||||
}
|
||||
}
|
||||
|
||||
/// Decide whether or not to generate completions, and the destination.
|
||||
///
|
||||
/// Note that `OUCH_COMPLETIONS_FOLDER` is checked before `GEN_COMPLETIONS`.
|
||||
fn detect_completions_output_directory() -> Option<PathBuf> {
|
||||
// Get directory from var
|
||||
if let Some(dir) = env::var_os("OUCH_COMPLETIONS_FOLDER") {
|
||||
return Some(dir.into());
|
||||
};
|
||||
|
||||
get_deprecated_completions_directory()
|
||||
}
|
||||
|
||||
fn get_deprecated_completions_directory() -> Option<PathBuf> {
|
||||
// If set, directory goes inside of cargo's `target/`
|
||||
let gen_completions = env::var_os("GEN_COMPLETIONS").map(|var| &var == "1").unwrap_or(false);
|
||||
if gen_completions {
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
let dir = Path::new(&out_dir).join("completions");
|
||||
Some(dir)
|
||||
} else {
|
||||
None
|
||||
for shell in Shell::value_variants() {
|
||||
generate_to(*shell, cmd, "ouch", out).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
32
src/opts.rs
32
src/opts.rs
@ -9,33 +9,33 @@ use clap::{Parser, ValueHint};
|
||||
///
|
||||
/// Repository: https://github.com/ouch-org/ouch
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(about, version)]
|
||||
#[command(about, version)]
|
||||
// Ignore bare urls in the documentation of this file because the doc comments
|
||||
// are also being used by Clap's --help generation
|
||||
#[allow(rustdoc::bare_urls)]
|
||||
pub struct Opts {
|
||||
/// Skip [Y/n] questions positively.
|
||||
#[clap(short, long, conflicts_with = "no", global = true)]
|
||||
#[arg(short, long, conflicts_with = "no", global = true)]
|
||||
pub yes: bool,
|
||||
|
||||
/// Skip [Y/n] questions negatively.
|
||||
#[clap(short, long, global = true)]
|
||||
#[arg(short, long, global = true)]
|
||||
pub no: bool,
|
||||
|
||||
/// Activate accessibility mode, reducing visual noise
|
||||
#[clap(short = 'A', long, env = "ACCESSIBLE", global = true)]
|
||||
#[arg(short = 'A', long, env = "ACCESSIBLE", global = true)]
|
||||
pub accessible: bool,
|
||||
|
||||
/// Ignores hidden files
|
||||
#[clap(short = 'H', long)]
|
||||
#[arg(short = 'H', long)]
|
||||
pub hidden: bool,
|
||||
|
||||
/// Ignores files matched by git's ignore files
|
||||
#[clap(short = 'g', long)]
|
||||
#[arg(short = 'g', long)]
|
||||
pub gitignore: bool,
|
||||
|
||||
/// Ouch and claps subcommands
|
||||
#[clap(subcommand)]
|
||||
#[command(subcommand)]
|
||||
pub cmd: Subcommand,
|
||||
}
|
||||
|
||||
@ -54,36 +54,36 @@ pub struct Opts {
|
||||
#[allow(rustdoc::bare_urls)]
|
||||
pub enum Subcommand {
|
||||
/// Compress one or more files into one output file.
|
||||
#[clap(alias = "c")]
|
||||
#[command(alias = "c")]
|
||||
Compress {
|
||||
/// Files to be compressed.
|
||||
#[clap(required = true, min_values = 1)]
|
||||
#[arg(required = true, num_args = 1..)]
|
||||
files: Vec<PathBuf>,
|
||||
|
||||
/// The resulting file. Its extensions can be used to specify the compression formats.
|
||||
#[clap(required = true, value_hint = ValueHint::FilePath)]
|
||||
#[arg(required = true, value_hint = ValueHint::FilePath)]
|
||||
output: PathBuf,
|
||||
},
|
||||
/// Decompresses one or more files, optionally into another folder.
|
||||
#[clap(alias = "d")]
|
||||
#[command(alias = "d")]
|
||||
Decompress {
|
||||
/// Files to be decompressed.
|
||||
#[clap(required = true, min_values = 1)]
|
||||
#[arg(required = true, num_args = 1..)]
|
||||
files: Vec<PathBuf>,
|
||||
|
||||
/// Place results in a directory other than the current one.
|
||||
#[clap(short = 'd', long = "dir", value_hint = ValueHint::DirPath)]
|
||||
#[arg(short = 'd', long = "dir", value_hint = ValueHint::DirPath)]
|
||||
output_dir: Option<PathBuf>,
|
||||
},
|
||||
/// List contents. Alias: l
|
||||
#[clap(alias = "l")]
|
||||
#[command(alias = "l")]
|
||||
List {
|
||||
/// Archives whose contents should be listed
|
||||
#[clap(required = true, min_values = 1)]
|
||||
#[arg(required = true, num_args = 1..)]
|
||||
archives: Vec<PathBuf>,
|
||||
|
||||
/// Show archive contents as a tree
|
||||
#[clap(short, long)]
|
||||
#[arg(short, long)]
|
||||
tree: bool,
|
||||
},
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user