mirror of
https://github.com/tealdeer-rs/tealdeer.git
synced 2026-08-22 16:14:18 +02:00
Merge pull request #298 from dbrgn/clap-v4
Migrate to Clap v4, bump MSRV to 1.75
This commit is contained in:
commit
83b2bdaf33
8 changed files with 394 additions and 192 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||
toolchain: [stable, 1.64.0]
|
||||
toolchain: [stable, 1.75.0]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
|
|||
393
Cargo.lock
generated
393
Cargo.lock
generated
|
|
@ -17,6 +17,55 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.68"
|
||||
|
|
@ -78,6 +127,12 @@ version = "1.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "1.1.0"
|
||||
|
|
@ -128,42 +183,49 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.2.23"
|
||||
version = "4.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
|
||||
checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"indexmap",
|
||||
"once_cell",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
"textwrap",
|
||||
"terminal_size",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "3.2.18"
|
||||
version = "4.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
|
||||
checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.2.4"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
|
||||
dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
|
|
@ -280,6 +342,16 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno-dragonfly"
|
||||
version = "0.1.2"
|
||||
|
|
@ -458,9 +530,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
|||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
|
|
@ -623,10 +695,16 @@ checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
|
|||
dependencies = [
|
||||
"hermit-abi 0.2.6",
|
||||
"io-lifetimes",
|
||||
"rustix",
|
||||
"rustix 0.36.5",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.5"
|
||||
|
|
@ -679,9 +757,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.139"
|
||||
version = "0.2.155"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
|
|
@ -689,6 +767,12 @@ version = "0.1.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
|
|
@ -792,7 +876,7 @@ version = "0.10.44"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29d971fd5722fec23977260f6e81aa67d2f22cadbdc2aa049f1022d9a3be1566"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"cfg-if",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
|
|
@ -809,7 +893,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -831,19 +915,13 @@ dependencies = [
|
|||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
|
||||
|
||||
[[package]]
|
||||
name = "pager"
|
||||
version = "0.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2599211a5c97fbbb1061d3dc751fa15f404927e4846e07c643287d6d1f462880"
|
||||
dependencies = [
|
||||
"errno",
|
||||
"errno 0.2.8",
|
||||
"libc",
|
||||
]
|
||||
|
||||
|
|
@ -901,44 +979,20 @@ dependencies = [
|
|||
"termtree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.49"
|
||||
version = "1.0.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
|
||||
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
|
@ -949,7 +1003,7 @@ version = "0.2.16"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1059,14 +1113,27 @@ version = "0.36.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"bitflags 1.3.2",
|
||||
"errno 0.2.8",
|
||||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"linux-raw-sys 0.1.4",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"errno 0.3.9",
|
||||
"libc",
|
||||
"linux-raw-sys 0.4.14",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.20.7"
|
||||
|
|
@ -1141,7 +1208,7 @@ version = "2.7.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
|
|
@ -1175,7 +1242,7 @@ checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1226,12 +1293,6 @@ version = "0.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.107"
|
||||
|
|
@ -1243,6 +1304,17 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tealdeer"
|
||||
version = "1.6.1"
|
||||
|
|
@ -1291,18 +1363,22 @@ dependencies = [
|
|||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "terminal_size"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
|
||||
dependencies = [
|
||||
"rustix 0.38.34",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termtree"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8"
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.38"
|
||||
|
|
@ -1320,7 +1396,7 @@ checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1469,18 +1545,18 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wait-timeout"
|
||||
version = "0.2.0"
|
||||
|
|
@ -1538,7 +1614,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
|
@ -1572,7 +1648,7 @@ checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
|
@ -1662,21 +1738,82 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_gnullvm 0.42.0",
|
||||
"windows_aarch64_msvc 0.42.0",
|
||||
"windows_i686_gnu 0.42.0",
|
||||
"windows_i686_msvc 0.42.0",
|
||||
"windows_x86_64_gnu 0.42.0",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_gnullvm 0.42.0",
|
||||
"windows_x86_64_msvc 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.5",
|
||||
"windows_aarch64_msvc 0.52.5",
|
||||
"windows_i686_gnu 0.52.5",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.5",
|
||||
"windows_x86_64_gnu 0.52.5",
|
||||
"windows_x86_64_gnullvm 0.52.5",
|
||||
"windows_x86_64_msvc 0.52.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
|
||||
|
||||
[[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_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.36.1"
|
||||
|
|
@ -1689,6 +1826,18 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.36.1"
|
||||
|
|
@ -1701,6 +1850,24 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
|
||||
|
||||
[[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_gnu"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.36.1"
|
||||
|
|
@ -1713,6 +1880,18 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.36.1"
|
||||
|
|
@ -1725,12 +1904,36 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
|
||||
|
||||
[[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_gnu"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
|
||||
|
||||
[[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_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.36.1"
|
||||
|
|
@ -1743,6 +1946,18 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.10.1"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ repository = "https://github.com/dbrgn/tealdeer/"
|
|||
documentation = "https://dbrgn.github.io/tealdeer/"
|
||||
version = "1.6.1"
|
||||
include = ["/src/**/*", "/tests/**/*", "/Cargo.toml", "/README.md", "/LICENSE-*", "/screenshot.png", "completion/*"]
|
||||
rust-version = "1.64"
|
||||
rust-version = "1.75"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
|
|
@ -23,7 +23,7 @@ path = "src/main.rs"
|
|||
anyhow = "1"
|
||||
app_dirs = { version = "2", package = "app_dirs2" }
|
||||
atty = "0.2"
|
||||
clap = { version = "3", features = ["std", "derive", "suggestions", "color"], default-features = false }
|
||||
clap = { version = "4", features = ["std", "derive", "help", "usage", "cargo", "error-context", "color", "wrap_help"], default-features = false }
|
||||
env_logger = { version = "0.10", optional = true }
|
||||
log = "0.4"
|
||||
reqwest = { version = "0.11.3", features = ["blocking"], default-features = false }
|
||||
|
|
|
|||
|
|
@ -1,30 +1,27 @@
|
|||
tealdeer 1.6.1
|
||||
tealdeer 1.6.1: A fast TLDR client
|
||||
Danilo Bargen <mail@dbrgn.ch>, Niklas Mohrin <dev@niklasmohrin.de>
|
||||
A fast TLDR client
|
||||
|
||||
USAGE:
|
||||
tldr [OPTIONS] [COMMAND]...
|
||||
Usage: tldr [OPTIONS] [COMMAND]...
|
||||
|
||||
ARGS:
|
||||
<COMMAND>... The command to show (e.g. `tar` or `git log`)
|
||||
Arguments:
|
||||
[COMMAND]... The command to show (e.g. `tar` or `git log`)
|
||||
|
||||
OPTIONS:
|
||||
-l, --list List all commands in the cache
|
||||
-f, --render <FILE> Render a specific markdown file
|
||||
-p, --platform <PLATFORMS> Override the operating system [possible values: linux, macos,
|
||||
windows, sunos, osx, android, freebsd, netbsd, openbsd]
|
||||
-L, --language <LANGUAGE> Override the language
|
||||
-u, --update Update the local cache
|
||||
--no-auto-update If auto update is configured, disable it for this run
|
||||
-c, --clear-cache Clear the local cache
|
||||
--pager Use a pager to page output
|
||||
-r, --raw Display the raw markdown instead of rendering it
|
||||
-q, --quiet Suppress informational messages
|
||||
--show-paths Show file and directory paths used by tealdeer
|
||||
--seed-config Create a basic config
|
||||
--color <WHEN> Control whether to use color [possible values: always, auto,
|
||||
never]
|
||||
-v, --version Print the version
|
||||
-h, --help Print help information
|
||||
Options:
|
||||
-l, --list List all commands in the cache
|
||||
-f, --render <FILE> Render a specific markdown file
|
||||
-p, --platform <PLATFORMS> Override the operating system [possible values: linux, macos, sunos,
|
||||
windows, android, freebsd, netbsd, openbsd]
|
||||
-L, --language <LANGUAGE> Override the language
|
||||
-u, --update Update the local cache
|
||||
--no-auto-update If auto update is configured, disable it for this run
|
||||
-c, --clear-cache Clear the local cache
|
||||
--pager Use a pager to page output
|
||||
-r, --raw Display the raw markdown instead of rendering it
|
||||
-q, --quiet Suppress informational messages
|
||||
--show-paths Show file and directory paths used by tealdeer
|
||||
--seed-config Create a basic config
|
||||
--color <WHEN> Control whether to use color [possible values: always, auto, never]
|
||||
-v, --version Print the version
|
||||
-h, --help Print help
|
||||
|
||||
To view the user documentation, please visit https://dbrgn.github.io/tealdeer/.
|
||||
|
|
|
|||
|
|
@ -314,9 +314,8 @@ impl Cache {
|
|||
// specific and common page directories, but not others.
|
||||
let should_walk = |entry: &DirEntry| -> bool {
|
||||
let file_type = entry.file_type();
|
||||
let file_name = match entry.file_name().to_str() {
|
||||
Some(name) => name,
|
||||
None => return false,
|
||||
let Some(file_name) = entry.file_name().to_str() else {
|
||||
return false;
|
||||
};
|
||||
if file_type.is_dir() {
|
||||
return file_name == "common" || platform_dirs.contains(&file_name);
|
||||
|
|
|
|||
61
src/cli.rs
61
src/cli.rs
|
|
@ -2,32 +2,38 @@
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::{AppSettings, ArgAction, ArgGroup, Parser};
|
||||
use clap::{arg, builder::ArgAction, command, ArgGroup, Parser};
|
||||
|
||||
use crate::types::{ColorOptions, PlatformType};
|
||||
|
||||
// Note: flag names are specified explicitly in clap attributes
|
||||
// to improve readability and allow contributors to grep names like "clear-cache"
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(about = "A fast TLDR client", author, version)]
|
||||
#[clap(
|
||||
after_help = "To view the user documentation, please visit https://dbrgn.github.io/tealdeer/."
|
||||
#[command(
|
||||
about = "A fast TLDR client",
|
||||
version,
|
||||
disable_version_flag = true,
|
||||
author,
|
||||
help_template = "{before-help}{name} {version}: {about-with-newline}{author-with-newline}
|
||||
{usage-heading} {usage}
|
||||
|
||||
{all-args}{after-help}",
|
||||
after_help = "To view the user documentation, please visit https://dbrgn.github.io/tealdeer/.",
|
||||
arg_required_else_help = true,
|
||||
help_expected = true,
|
||||
group = ArgGroup::new("command_or_file").args(&["command", "render"]),
|
||||
)]
|
||||
#[clap(setting = AppSettings::DeriveDisplayOrder)]
|
||||
#[clap(arg_required_else_help(true))]
|
||||
#[clap(disable_colored_help(true))]
|
||||
#[clap(group = ArgGroup::new("command_or_file").args(&["command", "render"]))]
|
||||
pub(crate) struct Args {
|
||||
pub(crate) struct Cli {
|
||||
/// The command to show (e.g. `tar` or `git log`)
|
||||
#[clap(min_values = 1)]
|
||||
#[arg(num_args(1..))]
|
||||
pub command: Vec<String>,
|
||||
|
||||
/// List all commands in the cache
|
||||
#[clap(short = 'l', long = "list")]
|
||||
#[arg(short = 'l', long = "list")]
|
||||
pub list: bool,
|
||||
|
||||
/// Render a specific markdown file
|
||||
#[clap(
|
||||
#[arg(
|
||||
short = 'f',
|
||||
long = "render",
|
||||
value_name = "FILE",
|
||||
|
|
@ -36,61 +42,56 @@ pub(crate) struct Args {
|
|||
pub render: Option<PathBuf>,
|
||||
|
||||
/// Override the operating system
|
||||
#[clap(
|
||||
#[arg(
|
||||
short = 'p',
|
||||
long = "platform",
|
||||
action = ArgAction::Append,
|
||||
possible_values = ["linux", "macos", "windows", "sunos", "osx", "android", "freebsd", "netbsd", "openbsd"],
|
||||
)]
|
||||
pub platforms: Option<Vec<PlatformType>>,
|
||||
|
||||
/// Override the language
|
||||
#[clap(short = 'L', long = "language")]
|
||||
#[arg(short = 'L', long = "language")]
|
||||
pub language: Option<String>,
|
||||
|
||||
/// Update the local cache
|
||||
#[clap(short = 'u', long = "update")]
|
||||
#[arg(short = 'u', long = "update")]
|
||||
pub update: bool,
|
||||
|
||||
/// If auto update is configured, disable it for this run
|
||||
#[clap(long = "no-auto-update", requires = "command_or_file")]
|
||||
#[arg(long = "no-auto-update", requires = "command_or_file")]
|
||||
pub no_auto_update: bool,
|
||||
|
||||
/// Clear the local cache
|
||||
#[clap(short = 'c', long = "clear-cache")]
|
||||
#[arg(short = 'c', long = "clear-cache")]
|
||||
pub clear_cache: bool,
|
||||
|
||||
/// Use a pager to page output
|
||||
#[clap(long = "pager", requires = "command_or_file")]
|
||||
#[arg(long = "pager", requires = "command_or_file")]
|
||||
pub pager: bool,
|
||||
|
||||
/// Display the raw markdown instead of rendering it
|
||||
#[clap(short = 'r', long = "--raw", requires = "command_or_file")]
|
||||
#[arg(short = 'r', long = "raw", requires = "command_or_file")]
|
||||
pub raw: bool,
|
||||
|
||||
/// Suppress informational messages
|
||||
#[clap(short = 'q', long = "quiet")]
|
||||
#[arg(short = 'q', long = "quiet")]
|
||||
pub quiet: bool,
|
||||
|
||||
/// Show file and directory paths used by tealdeer
|
||||
#[clap(long = "show-paths")]
|
||||
#[arg(long = "show-paths")]
|
||||
pub show_paths: bool,
|
||||
|
||||
/// Create a basic config
|
||||
#[clap(long = "seed-config")]
|
||||
#[arg(long = "seed-config")]
|
||||
pub seed_config: bool,
|
||||
|
||||
/// Control whether to use color
|
||||
#[clap(
|
||||
long = "color",
|
||||
value_name = "WHEN",
|
||||
possible_values = ["always", "auto", "never"]
|
||||
)]
|
||||
#[arg(long = "color", value_name = "WHEN")]
|
||||
pub color: Option<ColorOptions>,
|
||||
|
||||
/// Print the version
|
||||
// Note: We override the version flag because clap uses `-V` by default,
|
||||
// while TLDR specification requires `-v` to be used.
|
||||
#[clap(short = 'v', long = "version")]
|
||||
pub version: bool,
|
||||
#[arg(short = 'v', long = "version", action = ArgAction::Version)]
|
||||
pub version: (),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ mod utils;
|
|||
|
||||
use crate::{
|
||||
cache::{Cache, CacheFreshness, PageLookupResult, TLDR_PAGES_DIR},
|
||||
cli::Args,
|
||||
cli::Cli,
|
||||
config::{get_config_dir, get_config_path, make_default_config, Config, PathWithSource},
|
||||
extensions::Dedup,
|
||||
output::print_page,
|
||||
|
|
@ -65,7 +65,7 @@ const ARCHIVE_URL: &str = "https://tldr.sh/assets/tldr.zip";
|
|||
|
||||
/// The cache should be updated if it was explicitly requested,
|
||||
/// or if an automatic update is due and allowed.
|
||||
fn should_update_cache(cache: &Cache, args: &Args, config: &Config) -> bool {
|
||||
fn should_update_cache(cache: &Cache, args: &Cli, config: &Config) -> bool {
|
||||
args.update
|
||||
|| (!args.no_auto_update
|
||||
&& config.updates.auto_update
|
||||
|
|
@ -81,7 +81,7 @@ enum CheckCacheResult {
|
|||
}
|
||||
|
||||
/// Check the cache for freshness. If it's stale or missing, show a warning.
|
||||
fn check_cache(cache: &Cache, args: &Args, enable_styles: bool) -> CheckCacheResult {
|
||||
fn check_cache(cache: &Cache, args: &Cli, enable_styles: bool) -> CheckCacheResult {
|
||||
match cache.freshness() {
|
||||
CacheFreshness::Fresh => CheckCacheResult::CacheFound,
|
||||
CacheFreshness::Stale(_) if args.quiet => CheckCacheResult::CacheFound,
|
||||
|
|
@ -243,7 +243,7 @@ fn main() {
|
|||
init_log();
|
||||
|
||||
// Parse arguments
|
||||
let args = Args::parse();
|
||||
let args = Cli::parse();
|
||||
|
||||
// Determine the usage of styles
|
||||
#[cfg(target_os = "windows")]
|
||||
|
|
|
|||
68
src/types.rs
68
src/types.rs
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use std::{fmt, str};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
|
||||
|
|
@ -11,8 +10,8 @@ use serde_derive::{Deserialize, Serialize};
|
|||
pub enum PlatformType {
|
||||
Linux,
|
||||
OsX,
|
||||
SunOs,
|
||||
Windows,
|
||||
SunOs,
|
||||
Android,
|
||||
FreeBsd,
|
||||
NetBsd,
|
||||
|
|
@ -24,8 +23,8 @@ impl fmt::Display for PlatformType {
|
|||
match self {
|
||||
Self::Linux => write!(f, "Linux"),
|
||||
Self::OsX => write!(f, "macOS / BSD"),
|
||||
Self::SunOs => write!(f, "SunOS"),
|
||||
Self::Windows => write!(f, "Windows"),
|
||||
Self::SunOs => write!(f, "SunOS"),
|
||||
Self::Android => write!(f, "Android"),
|
||||
Self::FreeBsd => write!(f, "FreeBSD"),
|
||||
Self::NetBsd => write!(f, "NetBSD"),
|
||||
|
|
@ -34,23 +33,30 @@ impl fmt::Display for PlatformType {
|
|||
}
|
||||
}
|
||||
|
||||
impl str::FromStr for PlatformType {
|
||||
type Err = anyhow::Error;
|
||||
impl clap::ValueEnum for PlatformType {
|
||||
fn value_variants<'a>() -> &'a [Self] {
|
||||
&[
|
||||
Self::Linux,
|
||||
Self::OsX,
|
||||
Self::SunOs,
|
||||
Self::Windows,
|
||||
Self::Android,
|
||||
Self::FreeBsd,
|
||||
Self::NetBsd,
|
||||
Self::OpenBsd,
|
||||
]
|
||||
}
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"linux" => Ok(Self::Linux),
|
||||
"osx" | "macos" => Ok(Self::OsX),
|
||||
"sunos" => Ok(Self::SunOs),
|
||||
"windows" => Ok(Self::Windows),
|
||||
"android" => Ok(Self::Android),
|
||||
"freebsd" => Ok(Self::FreeBsd),
|
||||
"netbsd" => Ok(Self::NetBsd),
|
||||
"openbsd" => Ok(Self::OpenBsd),
|
||||
other => Err(anyhow!(
|
||||
"Unknown OS: {}. Possible values: linux, macos, osx, sunos, windows, android, freebsd, netbsd, openbsd",
|
||||
other
|
||||
)),
|
||||
fn to_possible_value<'a>(&self) -> Option<clap::builder::PossibleValue> {
|
||||
match self {
|
||||
Self::Linux => Some(clap::builder::PossibleValue::new("linux")),
|
||||
Self::OsX => Some(clap::builder::PossibleValue::new("macos").alias("osx")),
|
||||
Self::Windows => Some(clap::builder::PossibleValue::new("windows")),
|
||||
Self::SunOs => Some(clap::builder::PossibleValue::new("sunos")),
|
||||
Self::Android => Some(clap::builder::PossibleValue::new("android")),
|
||||
Self::FreeBsd => Some(clap::builder::PossibleValue::new("freebsd")),
|
||||
Self::NetBsd => Some(clap::builder::PossibleValue::new("netbsd")),
|
||||
Self::OpenBsd => Some(clap::builder::PossibleValue::new("openbsd")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -76,17 +82,17 @@ impl PlatformType {
|
|||
Self::Android
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "freebsd"))]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
pub fn current() -> Self {
|
||||
Self::FreeBsd
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "netbsd"))]
|
||||
#[cfg(target_os = "netbsd")]
|
||||
pub fn current() -> Self {
|
||||
Self::NetBsd
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "openbsd"))]
|
||||
#[cfg(target_os = "openbsd")]
|
||||
pub fn current() -> Self {
|
||||
Self::OpenBsd
|
||||
}
|
||||
|
|
@ -106,7 +112,7 @@ impl PlatformType {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Copy, Clone, Deserialize)]
|
||||
#[derive(Debug, Eq, PartialEq, Copy, Clone, Deserialize, clap::ValueEnum)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ColorOptions {
|
||||
Always,
|
||||
|
|
@ -114,22 +120,6 @@ pub enum ColorOptions {
|
|||
Never,
|
||||
}
|
||||
|
||||
impl str::FromStr for ColorOptions {
|
||||
type Err = anyhow::Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self> {
|
||||
match s {
|
||||
"always" => Ok(Self::Always),
|
||||
"auto" => Ok(Self::Auto),
|
||||
"never" => Ok(Self::Never),
|
||||
other => Err(anyhow!(
|
||||
"Unknown color option: {}. Possible values: always, auto, never",
|
||||
other
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ColorOptions {
|
||||
fn default() -> Self {
|
||||
Self::Auto
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue