mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-14 22:22:26 +00:00
Add --hyperlink flag
This commit is contained in:
parent
7e49ca7a48
commit
52c04df660
9 changed files with 474 additions and 139 deletions
303
Cargo.lock
generated
303
Cargo.lock
generated
|
@ -37,7 +37,7 @@ checksum = "c98233c6673d8601ab23e77eb38f999c51100d46c5703b17288c57fddf3a1ffe"
|
|||
dependencies = [
|
||||
"bstr",
|
||||
"doc-comment",
|
||||
"predicates 2.0.2",
|
||||
"predicates 2.1.1",
|
||||
"predicates-core",
|
||||
"predicates-tree",
|
||||
"wait-timeout",
|
||||
|
@ -45,13 +45,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "assert_fs"
|
||||
version = "1.0.3"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0ca6aa3066e6c6f0357e056a25fa95e8737f15a04f9aead0b22d0d082a39465"
|
||||
checksum = "cf09bb72e00da477c2596865e8873227e2196d263cca35414048875dbbeea1be"
|
||||
dependencies = [
|
||||
"doc-comment",
|
||||
"globwalk",
|
||||
"predicates 2.0.2",
|
||||
"predicates 2.1.1",
|
||||
"predicates-core",
|
||||
"predicates-tree",
|
||||
"tempfile",
|
||||
|
@ -70,9 +70,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
|
@ -82,9 +82,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
|||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "0.2.16"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
|
||||
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"memchr",
|
||||
|
@ -121,9 +121,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
version = "2.33.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
|
||||
checksum = "826bf7bc84f9435630275cb8e802a4a0ec792b615969934bd16d42ffed10f207"
|
||||
dependencies = [
|
||||
"ansi_term 0.11.0",
|
||||
"atty",
|
||||
|
@ -137,9 +137,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.5"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
|
||||
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"lazy_static",
|
||||
|
@ -194,9 +194,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780"
|
||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
|
@ -209,18 +209,21 @@ version = "0.3.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "float-cmp"
|
||||
version = "0.8.0"
|
||||
|
@ -238,9 +241,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.3"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
|
||||
checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
|
@ -298,6 +301,17 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "140a09c9305e6d5e557e2ed7cbc68e05765a7d4213975b87cb04920689cc6219"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ignore"
|
||||
version = "0.4.18"
|
||||
|
@ -318,9 +332,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.7.0"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
||||
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
|
@ -328,18 +342,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.10"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d"
|
||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.1"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
|
||||
checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
@ -352,9 +366,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.100"
|
||||
version = "0.2.121"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5"
|
||||
checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
|
@ -364,18 +378,18 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
|||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.4"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
|
||||
checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
version = "0.4.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
@ -413,6 +427,7 @@ dependencies = [
|
|||
"term_grid",
|
||||
"terminal_size",
|
||||
"unicode-width",
|
||||
"url",
|
||||
"users",
|
||||
"version_check",
|
||||
"wild",
|
||||
|
@ -422,6 +437,12 @@ dependencies = [
|
|||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.1"
|
||||
|
@ -430,9 +451,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
|||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.7.13"
|
||||
version = "0.7.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16"
|
||||
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
|
@ -458,9 +479,9 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
|
|||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
|
||||
checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
@ -486,15 +507,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.8.0"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.1"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
|
||||
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
|
||||
dependencies = [
|
||||
"instant",
|
||||
"lock_api",
|
||||
|
@ -503,9 +524,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.8.3"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
|
||||
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"instant",
|
||||
|
@ -516,10 +537,10 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.10"
|
||||
name = "percent-encoding"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||
|
||||
[[package]]
|
||||
name = "predicates"
|
||||
|
@ -536,9 +557,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "predicates"
|
||||
version = "2.0.2"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c143348f141cc87aab5b950021bac6145d0e5ae754b0591de23244cee42c9308"
|
||||
checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c"
|
||||
dependencies = [
|
||||
"difflib",
|
||||
"itertools",
|
||||
|
@ -547,102 +568,63 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "predicates-core"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451"
|
||||
checksum = "da1c2388b1513e1b605fcec39a95e0a9e8ef088f71443ef37099fa9ae6673fcb"
|
||||
|
||||
[[package]]
|
||||
name = "predicates-tree"
|
||||
version = "1.0.3"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7dd0fd014130206c9352efbdc92be592751b2b9274dff685348341082c6ea3d"
|
||||
checksum = "4d86de6de25020a36c6d3643a86d9a6a9f552107c0559c60ea03551b5e16c032"
|
||||
dependencies = [
|
||||
"predicates-core",
|
||||
"treeline",
|
||||
"termtree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.28"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612"
|
||||
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.10"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
|
||||
checksum = "8ae183fc1b06c149f0c1793e1eb447c8b04bfe46d48e9e48bfb8d2d7ed64ecf0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.0"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
|
||||
checksum = "7776223e2696f1aa4c6b0170e83212f47296a00424305117d013dfe86fb0fe55"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"redox_syscall",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
version = "1.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -670,6 +652,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
|
@ -687,18 +675,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.129"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1"
|
||||
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.129"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e57ae87ad533d9a56427558b516d0adac283614e347abf85b0dc0cbbf0a249f3"
|
||||
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -707,12 +695,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_yaml"
|
||||
version = "0.8.19"
|
||||
version = "0.8.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6375dbd828ed6964c3748e4ef6d18e7a175d408ffe184bca01698d0c73f915a9"
|
||||
checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0"
|
||||
dependencies = [
|
||||
"dtoa",
|
||||
"indexmap",
|
||||
"ryu",
|
||||
"serde",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
@ -771,9 +759,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.6.1"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
|
@ -783,9 +771,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.75"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7"
|
||||
checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -794,13 +782,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.2.0"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
|
||||
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"libc",
|
||||
"rand",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi",
|
||||
|
@ -835,6 +823,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termtree"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b"
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
|
@ -846,10 +840,30 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.3"
|
||||
name = "thiserror"
|
||||
version = "1.0.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
|
||||
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
@ -865,16 +879,40 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "treeline"
|
||||
name = "tinyvec"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec_macros"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
|
||||
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
|
||||
dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
||||
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
|
@ -882,6 +920,17 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb"
|
||||
dependencies = [
|
||||
"idna",
|
||||
"matches",
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "users"
|
||||
version = "0.11.0"
|
||||
|
@ -900,9 +949,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
|||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.3"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wait-timeout"
|
||||
|
|
|
@ -37,6 +37,7 @@ xdg = "2.1.*"
|
|||
yaml-rust = "0.4.*"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_yaml = "0.8"
|
||||
url = "2.1.*"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
users = "0.11.*"
|
||||
|
|
11
src/app.rs
11
src/app.rs
|
@ -318,6 +318,17 @@ pub fn build() -> App<'static, 'static> {
|
|||
.takes_value(false)
|
||||
.help("Print security context (label) of each file"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("hyperlink")
|
||||
.long("hyperlink")
|
||||
.possible_value("always")
|
||||
.possible_value("auto")
|
||||
.possible_value("never")
|
||||
.default_value("auto")
|
||||
.multiple(true)
|
||||
.number_of_values(1)
|
||||
.help("Attach hyperlink to filenames"),
|
||||
)
|
||||
}
|
||||
|
||||
fn validate_date_argument(arg: String) -> Result<(), String> {
|
||||
|
|
|
@ -4,6 +4,7 @@ use crate::flags::layout::Layout;
|
|||
use crate::flags::permission::PermissionFlag;
|
||||
use crate::flags::size::SizeFlag;
|
||||
use crate::flags::sorting::{DirGrouping, SortColumn};
|
||||
use crate::flags::HyperlinkOption;
|
||||
use crate::flags::{ColorOption, ThemeOption};
|
||||
///! This module provides methods to handle the program's config files and operations related to
|
||||
///! this.
|
||||
|
@ -42,6 +43,7 @@ pub struct Config {
|
|||
pub no_symlink: Option<bool>,
|
||||
pub total_size: Option<bool>,
|
||||
pub symlink_arrow: Option<String>,
|
||||
pub hyperlink: Option<HyperlinkOption>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, Deserialize)]
|
||||
|
@ -92,6 +94,7 @@ impl Config {
|
|||
no_symlink: None,
|
||||
total_size: None,
|
||||
symlink_arrow: None,
|
||||
hyperlink: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,6 +334,7 @@ mod tests {
|
|||
use crate::flags::permission::PermissionFlag;
|
||||
use crate::flags::size::SizeFlag;
|
||||
use crate::flags::sorting::{DirGrouping, SortColumn};
|
||||
use crate::flags::HyperlinkOption;
|
||||
|
||||
#[test]
|
||||
fn test_read_default() {
|
||||
|
@ -378,6 +382,7 @@ mod tests {
|
|||
no_symlink: Some(false),
|
||||
total_size: Some(false),
|
||||
symlink_arrow: Some("⇒".into()),
|
||||
hyperlink: Some(HyperlinkOption::Never),
|
||||
},
|
||||
c
|
||||
);
|
||||
|
|
|
@ -289,7 +289,8 @@ fn get_output<'a>(
|
|||
Block::Date => block_vec.push(meta.date.render(colors, flags)),
|
||||
Block::Name => {
|
||||
block_vec.extend(vec![
|
||||
meta.name.render(colors, icons, display_option),
|
||||
meta.name
|
||||
.render(colors, icons, display_option, flags.hyperlink),
|
||||
meta.indicator.render(flags),
|
||||
]);
|
||||
if !(flags.no_symlink.0 || flags.dereference.0 || flags.layout == Layout::Grid) {
|
||||
|
@ -395,6 +396,7 @@ mod tests {
|
|||
&Colors::new(color::ThemeOption::NoColor),
|
||||
&Icons::new(icon::Theme::NoIcon, " ".to_string()),
|
||||
&DisplayOption::FileName,
|
||||
false,
|
||||
)
|
||||
.to_string();
|
||||
|
||||
|
@ -428,6 +430,7 @@ mod tests {
|
|||
&Colors::new(color::ThemeOption::NoColor),
|
||||
&Icons::new(icon::Theme::Fancy, " ".to_string()),
|
||||
&DisplayOption::FileName,
|
||||
false,
|
||||
)
|
||||
.to_string();
|
||||
|
||||
|
@ -460,6 +463,7 @@ mod tests {
|
|||
&Colors::new(color::ThemeOption::NoLscolors),
|
||||
&Icons::new(icon::Theme::NoIcon, " ".to_string()),
|
||||
&DisplayOption::FileName,
|
||||
false,
|
||||
)
|
||||
.to_string();
|
||||
|
||||
|
@ -501,6 +505,7 @@ mod tests {
|
|||
&Colors::new(color::ThemeOption::NoColor),
|
||||
&Icons::new(icon::Theme::NoIcon, " ".to_string()),
|
||||
&DisplayOption::FileName,
|
||||
false,
|
||||
)
|
||||
.to_string();
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ pub mod sorting;
|
|||
pub mod symlink_arrow;
|
||||
pub mod symlinks;
|
||||
pub mod total_size;
|
||||
pub mod hyperlink;
|
||||
|
||||
pub use blocks::Block;
|
||||
pub use blocks::Blocks;
|
||||
|
@ -22,6 +23,7 @@ pub use color::{ColorOption, ThemeOption};
|
|||
pub use date::DateFlag;
|
||||
pub use dereference::Dereference;
|
||||
pub use display::Display;
|
||||
pub use hyperlink::HyperlinkOption;
|
||||
pub use icons::IconOption;
|
||||
pub use icons::IconSeparator;
|
||||
pub use icons::IconTheme;
|
||||
|
@ -66,6 +68,7 @@ pub struct Flags {
|
|||
pub sorting: Sorting,
|
||||
pub total_size: TotalSize,
|
||||
pub symlink_arrow: SymlinkArrow,
|
||||
pub hyperlink: HyperlinkOption,
|
||||
}
|
||||
|
||||
impl Flags {
|
||||
|
@ -93,6 +96,7 @@ impl Flags {
|
|||
sorting: Sorting::configure_from(matches, config),
|
||||
total_size: TotalSize::configure_from(matches, config),
|
||||
symlink_arrow: SymlinkArrow::configure_from(matches, config),
|
||||
hyperlink: HyperlinkOption::configure_from(matches, config),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
173
src/flags/hyperlink.rs
Normal file
173
src/flags/hyperlink.rs
Normal file
|
@ -0,0 +1,173 @@
|
|||
//! This module defines the [HyperlinkOption]. To set it up from [ArgMatches], a [Config] and its
|
||||
//! [Default] value, use its [configure_from](Configurable::configure_from) method.
|
||||
|
||||
use super::Configurable;
|
||||
|
||||
use crate::config_file::Config;
|
||||
|
||||
use clap::ArgMatches;
|
||||
use serde::Deserialize;
|
||||
|
||||
/// The flag showing when to use hyperlink in the output.
|
||||
#[derive(Clone, Debug, Copy, PartialEq, Eq, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum HyperlinkOption {
|
||||
Always,
|
||||
Auto,
|
||||
Never,
|
||||
}
|
||||
|
||||
impl Configurable<Self> for HyperlinkOption {
|
||||
/// Get a potential `HyperlinkOption` variant from [ArgMatches].
|
||||
///
|
||||
/// If the "classic" argument is passed, then this returns the [HyperlinkOption::Never] variant in
|
||||
/// a [Some]. Otherwise if the argument is passed, this returns the variant corresponding to
|
||||
/// its parameter in a [Some]. Otherwise this returns [None].
|
||||
fn from_arg_matches(matches: &ArgMatches) -> Option<Self> {
|
||||
if matches.is_present("classic") {
|
||||
Some(Self::Never)
|
||||
} else if matches.occurrences_of("hyperlink") > 0 {
|
||||
match matches.values_of("hyperlink")?.last() {
|
||||
Some("always") => Some(Self::Always),
|
||||
Some("auto") => Some(Self::Auto),
|
||||
Some("never") => Some(Self::Never),
|
||||
_ => panic!("This should not be reachable!"),
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Get a potential `HyperlinkOption` variant from a [Config].
|
||||
///
|
||||
/// If the `Configs::classic` has value and is "true" then this returns Some(HyperlinkOption::Never).
|
||||
/// Otherwise if the `Config::hyperlink::when` has value and is one of "always", "auto" or "never",
|
||||
/// this returns its corresponding variant in a [Some].
|
||||
/// Otherwise this returns [None].
|
||||
fn from_config(config: &Config) -> Option<Self> {
|
||||
if let Some(true) = &config.classic {
|
||||
return Some(Self::Never);
|
||||
}
|
||||
|
||||
config.hyperlink
|
||||
}
|
||||
}
|
||||
|
||||
/// The default value for the `HyperlinkOption` is [HyperlinkOption::Auto].
|
||||
impl Default for HyperlinkOption {
|
||||
fn default() -> Self {
|
||||
Self::Never
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_hyperlink_option {
|
||||
use super::HyperlinkOption;
|
||||
|
||||
use crate::app;
|
||||
use crate::config_file::Config;
|
||||
use crate::flags::Configurable;
|
||||
|
||||
#[test]
|
||||
fn test_from_arg_matches_none() {
|
||||
let argv = vec!["lsd"];
|
||||
let matches = app::build().get_matches_from_safe(argv).unwrap();
|
||||
assert_eq!(None, HyperlinkOption::from_arg_matches(&matches));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_arg_matches_always() {
|
||||
let argv = vec!["lsd", "--hyperlink", "always"];
|
||||
let matches = app::build().get_matches_from_safe(argv).unwrap();
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Always),
|
||||
HyperlinkOption::from_arg_matches(&matches)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_arg_matches_autp() {
|
||||
let argv = vec!["lsd", "--hyperlink", "auto"];
|
||||
let matches = app::build().get_matches_from_safe(argv).unwrap();
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Auto),
|
||||
HyperlinkOption::from_arg_matches(&matches)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_arg_matches_never() {
|
||||
let argv = vec!["lsd", "--hyperlink", "never"];
|
||||
let matches = app::build().get_matches_from_safe(argv).unwrap();
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Never),
|
||||
HyperlinkOption::from_arg_matches(&matches)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_arg_matches_classic_mode() {
|
||||
let argv = vec!["lsd", "--hyperlink", "always", "--classic"];
|
||||
let matches = app::build().get_matches_from_safe(argv).unwrap();
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Never),
|
||||
HyperlinkOption::from_arg_matches(&matches)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_arg_matches_hyperlink_when_multi() {
|
||||
let argv = vec!["lsd", "--hyperlink", "always", "--hyperlink", "never"];
|
||||
let matches = app::build().get_matches_from_safe(argv).unwrap();
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Never),
|
||||
HyperlinkOption::from_arg_matches(&matches)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_config_none() {
|
||||
assert_eq!(None, HyperlinkOption::from_config(&Config::with_none()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_config_always() {
|
||||
let mut c = Config::with_none();
|
||||
c.hyperlink = Some(HyperlinkOption::Always);
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Always),
|
||||
HyperlinkOption::from_config(&c)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_config_auto() {
|
||||
let mut c = Config::with_none();
|
||||
c.hyperlink = Some(HyperlinkOption::Auto);
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Auto),
|
||||
HyperlinkOption::from_config(&c)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_config_never() {
|
||||
let mut c = Config::with_none();
|
||||
c.hyperlink = Some(HyperlinkOption::Never);
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Never),
|
||||
HyperlinkOption::from_config(&c)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_config_classic_mode() {
|
||||
let mut c = Config::with_none();
|
||||
c.classic = Some(true);
|
||||
c.hyperlink = Some(HyperlinkOption::Always);
|
||||
assert_eq!(
|
||||
Some(HyperlinkOption::Never),
|
||||
HyperlinkOption::from_config(&c)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ extern crate unicode_width;
|
|||
extern crate wild;
|
||||
extern crate xdg;
|
||||
extern crate yaml_rust;
|
||||
extern crate url;
|
||||
|
||||
#[cfg(unix)]
|
||||
extern crate users;
|
||||
|
|
108
src/meta/name.rs
108
src/meta/name.rs
|
@ -1,6 +1,8 @@
|
|||
use crate::color::{ColoredString, Colors, Elem};
|
||||
use crate::flags::HyperlinkOption;
|
||||
use crate::icon::Icons;
|
||||
use crate::meta::filetype::FileType;
|
||||
use crate::url::Url;
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
use std::ffi::OsStr;
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
|
@ -101,10 +103,23 @@ impl Name {
|
|||
colors: &Colors,
|
||||
icons: &Icons,
|
||||
display_option: &DisplayOption,
|
||||
hyperlink: HyperlinkOption,
|
||||
) -> ColoredString {
|
||||
let name = &match hyperlink {
|
||||
HyperlinkOption::Always => {
|
||||
let url = Url::from_file_path(&self.path).expect("absolute path");
|
||||
|
||||
// Crossterm does not support hyperlinks as of now
|
||||
// https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
|
||||
format!("\x1B;;{}\x1B\x5C{}\x1B;;\x1B\x5C", url, self.file_name())
|
||||
}
|
||||
|
||||
_ => self.file_name().to_string(),
|
||||
};
|
||||
|
||||
let content = match display_option {
|
||||
DisplayOption::FileName => {
|
||||
format!("{}{}", icons.get(self), self.escape(self.file_name()))
|
||||
format!("{}{}", icons.get(self), self.escape(name))
|
||||
}
|
||||
DisplayOption::Relative { base_path } => format!(
|
||||
"{}{}",
|
||||
|
@ -166,12 +181,15 @@ mod test {
|
|||
use super::DisplayOption;
|
||||
use super::Name;
|
||||
use crate::color::{self, Colors};
|
||||
use crate::flags::HyperlinkOption;
|
||||
use crate::icon::{self, Icons};
|
||||
use crate::meta::FileType;
|
||||
use crate::meta::Meta;
|
||||
#[cfg(unix)]
|
||||
use crate::meta::Permissions;
|
||||
use crossterm::style::{Color, Stylize};
|
||||
#[cfg(unix)]
|
||||
use crate::url::Url;
|
||||
use std::cmp::Ordering;
|
||||
use std::fs::{self, File};
|
||||
#[cfg(unix)]
|
||||
|
@ -198,7 +216,12 @@ mod test {
|
|||
|
||||
assert_eq!(
|
||||
" file.txt".to_string().with(Color::AnsiValue(184)),
|
||||
name.render(&colors, &icons, &DisplayOption::FileName)
|
||||
name.render(
|
||||
&colors,
|
||||
&icons,
|
||||
&DisplayOption::FileName,
|
||||
HyperlinkOption::Never
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -207,7 +230,7 @@ mod test {
|
|||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let icons = Icons::new(icon::Theme::Fancy, " ".to_string());
|
||||
|
||||
// Chreate the directory
|
||||
// Create the directory
|
||||
let dir_path = tmp_dir.path().join("directory");
|
||||
fs::create_dir(&dir_path).expect("failed to create the dir");
|
||||
let meta = Meta::from_path(&dir_path, false).unwrap();
|
||||
|
@ -216,8 +239,13 @@ mod test {
|
|||
|
||||
assert_eq!(
|
||||
" directory".to_string().with(Color::AnsiValue(33)),
|
||||
meta.name.render(&colors, &icons, &DisplayOption::FileName)
|
||||
);
|
||||
meta.name.render(
|
||||
&colors,
|
||||
&icons,
|
||||
&DisplayOption::FileName,
|
||||
HyperlinkOption::Never
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -244,7 +272,12 @@ mod test {
|
|||
|
||||
assert_eq!(
|
||||
" target.tmp".to_string().with(Color::AnsiValue(44)),
|
||||
name.render(&colors, &icons, &DisplayOption::FileName)
|
||||
name.render(
|
||||
&colors,
|
||||
&icons,
|
||||
&DisplayOption::FileName,
|
||||
HyperlinkOption::Never
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -272,7 +305,12 @@ mod test {
|
|||
|
||||
assert_eq!(
|
||||
" target.d".to_string().with(Color::AnsiValue(44)),
|
||||
name.render(&colors, &icons, &DisplayOption::FileName)
|
||||
name.render(
|
||||
&colors,
|
||||
&icons,
|
||||
&DisplayOption::FileName,
|
||||
HyperlinkOption::Never
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -298,7 +336,12 @@ mod test {
|
|||
|
||||
assert_eq!(
|
||||
" pipe.tmp".to_string().with(Color::AnsiValue(184)),
|
||||
name.render(&colors, &icons, &DisplayOption::FileName)
|
||||
name.render(
|
||||
&colors,
|
||||
&icons,
|
||||
&DisplayOption::FileName,
|
||||
HyperlinkOption::Never
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -317,12 +360,45 @@ mod test {
|
|||
assert_eq!(
|
||||
"file.txt",
|
||||
meta.name
|
||||
.render(&colors, &icons, &DisplayOption::FileName)
|
||||
.render(
|
||||
&colors,
|
||||
&icons,
|
||||
&DisplayOption::FileName,
|
||||
HyperlinkOption::Never
|
||||
)
|
||||
.to_string()
|
||||
.as_str()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_print_hyperlink() {
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let icons = Icons::new(icon::Theme::Fancy);
|
||||
|
||||
// Create the file;
|
||||
let file_path = tmp_dir.path().join("file.txt");
|
||||
File::create(&file_path).expect("failed to create file");
|
||||
let meta = file_path.metadata().expect("failed to get metas");
|
||||
|
||||
let colors = Colors::new(color::Theme::NoLscolors);
|
||||
let file_type = FileType::new(&meta, &Permissions::from(&meta));
|
||||
let name = Name::new(&file_path, file_type);
|
||||
|
||||
let real_path = std::fs::canonicalize(&file_path).expect("canonicalize");
|
||||
let expected_url = Url::from_file_path(&real_path).expect("absolute path");
|
||||
let expected_text = format!(
|
||||
" \x1B]8;;{}\x1B\x5C{}\x1B]8;;\x1B\x5C",
|
||||
expected_url, "file.txt"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
Colour::Fixed(184).paint(expected_text),
|
||||
name.render(&colors, &icons, true)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extensions_with_valid_file() {
|
||||
let path = Path::new("some-file.txt");
|
||||
|
@ -533,7 +609,12 @@ mod test {
|
|||
|
||||
assert_eq!(
|
||||
" file\\ttab.txt".to_string().with(Color::AnsiValue(184)),
|
||||
name.render(&colors, &icons, &DisplayOption::FileName)
|
||||
name.render(
|
||||
&colors,
|
||||
&icons,
|
||||
&DisplayOption::FileName,
|
||||
HyperlinkOption::Never
|
||||
)
|
||||
);
|
||||
|
||||
let file_path = tmp_dir.path().join("file\nnewline.txt");
|
||||
|
@ -548,7 +629,12 @@ mod test {
|
|||
" file\\nnewline.txt"
|
||||
.to_string()
|
||||
.with(Color::AnsiValue(184)),
|
||||
name.render(&colors, &icons, &DisplayOption::FileName)
|
||||
name.render(
|
||||
&colors,
|
||||
&icons,
|
||||
&DisplayOption::FileName,
|
||||
HyperlinkOption::Never
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue