mirror of https://github.com/xvxx/phetch
Compare commits
74 Commits
Author | SHA1 | Date |
---|---|---|
chris west | d0b503ebcf | 1 year ago |
chris west | 38dff71ac0 | 1 year ago |
deadjakk | b29ea2cee4 | 1 year ago |
deadjakk | cf2810af80 | 1 year ago |
deadjakk | 4a5328a14e | 1 year ago |
chris west | 3f2ae945db | 1 year ago |
chris west | 0c970dcb3a | 2 years ago |
chris west | fab97539d9 | 2 years ago |
chris west | 8eb15db192 | 2 years ago |
chris west | 2a55fc3763 | 2 years ago |
drclaw | d90d8bad45 | 2 years ago |
chris west | eb960a78cd | 2 years ago |
chris west | 751553c0fd | 2 years ago |
chris west | 6d7ea11598 | 2 years ago |
chris west | fb1b3d2185 | 2 years ago |
chris west | 9baac849e5 | 2 years ago |
chris west | 89b5febd4b | 2 years ago |
chris west | 02cfc41aa2 | 2 years ago |
chris west | fe1fbf5009 | 2 years ago |
chris west | 8ebeb8dec9 | 2 years ago |
chris west | 6861848217 | 2 years ago |
chris west | 4029fca177 | 2 years ago |
chris west | 79174e329f | 2 years ago |
chris west | 7eefac1c26 | 2 years ago |
chris west | 9e6f1b46f0 | 2 years ago |
chris west | 9da392c04b | 2 years ago |
chris west | 7522427d71 | 2 years ago |
chris west | 105b737d1d | 2 years ago |
walksanatora | e587fad0e6 | 2 years ago |
kakuhen | fee4e316e3 | 2 years ago |
chris west | 6572bf7fca | 4 years ago |
chris west | 17fedeb262 | 4 years ago |
chris west | 082d70cee7 | 4 years ago |
chris west | e98b3ac129 | 4 years ago |
chris west | 8ad88f32b9 | 4 years ago |
chris west | f3dff96429 | 4 years ago |
chris west | 16034d184e | 4 years ago |
chris west | dffaafd1fb | 4 years ago |
chris west | 495e47b5ac | 4 years ago |
chris west | 0edee37c44 | 4 years ago |
chris west | 8f7f74927e | 4 years ago |
chris west | 6231044f58 | 4 years ago |
chris west | ad43179f19 | 4 years ago |
chris west | e6583a81f3 | 4 years ago |
chris west | ba7d527165 | 4 years ago |
chris west | bfdd01e22a | 4 years ago |
chris west | c2c5e1c086 | 4 years ago |
chris west | e28a5469a4 | 4 years ago |
chris west | 02b368ae52 | 4 years ago |
chris west | e5f0f22ec5 | 4 years ago |
chris west | bacacf032e | 4 years ago |
chris west | 6825891b88 | 4 years ago |
chris west | cf9e16650e | 4 years ago |
chris west | c07656509f | 4 years ago |
chris west | fa3dd26db5 | 4 years ago |
chris west | 40479908a8 | 4 years ago |
chris west | 29c10d8042 | 4 years ago |
chris west | 4f652a7209 | 4 years ago |
chris west | 3d6e05c081 | 4 years ago |
chris west | a5c645f402 | 4 years ago |
chris west | 400fe770a9 | 4 years ago |
chris west | 5df09aead9 | 4 years ago |
chris west | 41324a0ff3 | 4 years ago |
chris west | 06344f734a | 4 years ago |
chris west | 80314f6bd6 | 4 years ago |
chris west | 252731d0de | 4 years ago |
chris west | 995870b9d4 | 4 years ago |
chris west | ffa2083740 | 4 years ago |
chris west | 5f232d8862 | 4 years ago |
chris west | 537aa7fbbd | 4 years ago |
chris west | 993ce83800 | 4 years ago |
chris west | 3c057b56f9 | 4 years ago |
chris west | bba6b5c740 | 4 years ago |
chris west | 508c2b44cb | 4 years ago |
@ -1,406 +1,436 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "0.1.7"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "c2-chacha"
|
||||
version = "0.2.3"
|
||||
name = "byteorder"
|
||||
version = "1.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.48"
|
||||
version = "1.0.76"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.6.4"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
||||
dependencies = [
|
||||
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.6.2"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||
|
||||
[[package]]
|
||||
name = "cp437"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "891a48ae269a368d5e45e0b13ee401f90d3d400da92d881f7cb67bc9da711c14"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
dependencies = [
|
||||
"foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types-shared"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.13"
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.6"
|
||||
name = "instant"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.66"
|
||||
version = "0.2.137"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.8"
|
||||
version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.3"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"openssl",
|
||||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
"schannel",
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "numtoa"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.26"
|
||||
version = "0.10.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"openssl-macros",
|
||||
"openssl-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-macros"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.1.2"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.53"
|
||||
version = "0.9.77"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"autocfg",
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phetch"
|
||||
version = "1.0.7"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tor-stream 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty",
|
||||
"cp437",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"native-tls",
|
||||
"termion",
|
||||
"tor-stream",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.17"
|
||||
version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.2"
|
||||
name = "proc-macro2"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
|
||||
dependencies = [
|
||||
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.1"
|
||||
name = "quote"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
||||
dependencies = [
|
||||
"c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
name = "redox_syscall"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "redox_termios"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f"
|
||||
dependencies = [
|
||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.16"
|
||||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "0.3.4"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"
|
||||
dependencies = [
|
||||
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"security-framework-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "0.3.3"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556"
|
||||
dependencies = [
|
||||
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socks"
|
||||
version = "0.3.2"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b"
|
||||
dependencies = [
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.1.0"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termion"
|
||||
version = "1.5.5"
|
||||
version = "1.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc",
|
||||
"numtoa",
|
||||
"redox_syscall",
|
||||
"redox_termios",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tor-stream"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5865109fc90e0bc0f8c299f3794ca0fd5771df988aa6b962d4c9129c39674746"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"socks 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static",
|
||||
"socks",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.8"
|
||||
name = "unicode-ident"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.8"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "ws2_32-sys"
|
||||
version = "0.2.1"
|
||||
name = "windows-sys"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||
dependencies = [
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
||||
"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
|
||||
"checksum cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f52a465a666ca3d838ebbf08b241383421412fe7ebb463527bba275526d89f76"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
|
||||
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
|
||||
"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407"
|
||||
"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e"
|
||||
"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
|
||||
"checksum openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)" = "3a3cc5799d98e1088141b8e01ff760112bbd9f19d850c124500566ca6901a585"
|
||||
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||
"checksum openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)" = "465d16ae7fc0e313318f7de5cecf57b2fbe7511fd213978b457e1c96ff46736f"
|
||||
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
||||
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
|
||||
"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412"
|
||||
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
|
||||
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
|
||||
"checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021"
|
||||
"checksum security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8ef2429d7cefe5fd28bd1d2ed41c944547d4ff84776f5935b456da44593a16df"
|
||||
"checksum security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895"
|
||||
"checksum socks 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e6a64cfa9346d26e836a49fcc1ddfcb4d3df666b6787b6864db61d4918e1cbc2"
|
||||
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
|
||||
"checksum termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905"
|
||||
"checksum tor-stream 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5865109fc90e0bc0f8c299f3794ca0fd5771df988aa6b962d4c9129c39674746"
|
||||
"checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"
|
||||
"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
[[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"
|
||||
|
@ -1,2 +1,4 @@
|
||||
[target.armv7-unknown-linux-gnueabihf]
|
||||
image = "rustembedded/cross:armv7-unknown-linux-gnueabihf-0.1.16"
|
||||
[target.aarch64-linux-android]
|
||||
image = "rustembedded/cross:aarch64-linux-android-0.1.16"
|
||||
|
@ -1,113 +0,0 @@
|
||||
//! Terminal colors.
|
||||
//! Provides a macro to color text as well as sturcts to get their
|
||||
//! raw ansi codes.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
/// Shortcut to produce a String colored with one or more colors.
|
||||
/// Example:
|
||||
/// ```
|
||||
/// let s = color_string!("Red string", Red);
|
||||
/// let x = color_string!("Hyperlink-ish", Blue, Underline);
|
||||
macro_rules! color_string {
|
||||
($s:expr, $( $color:ident ),+) => {{
|
||||
let mut out = String::from("\x1b[");
|
||||
$( out.push_str(crate::color::$color::code()); out.push_str(";"); )+
|
||||
out.push('m');
|
||||
out.push_str(&$s);
|
||||
out.push_str(crate::color::Reset.as_ref());
|
||||
out.replace(";m", "m")
|
||||
}};
|
||||
}
|
||||
|
||||
/// Shortcut to produce a color's ANSI escape code. Don't forget to Reset!
|
||||
/// ```
|
||||
/// let mut o = String::new();
|
||||
/// o.push_str(color!(Blue));
|
||||
/// o.push_str(color!(Underline));
|
||||
/// o.push_str("Hyperlinkish.");
|
||||
/// o.push_str(color!(Reset));
|
||||
macro_rules! color {
|
||||
($color:ident) => {
|
||||
crate::color::$color.as_ref()
|
||||
};
|
||||
}
|
||||
|
||||
/// Create a color:: struct that can be used with format!.
|
||||
/// Example:
|
||||
/// ```
|
||||
/// define_color(Red, 91);
|
||||
/// define_color(Reset, 0);
|
||||
///
|
||||
/// println!("{}Error: {}{}", color::Red, msg, color::Reset);
|
||||
macro_rules! define_color {
|
||||
($color:ident, $code:literal) => {
|
||||
#[allow(missing_docs)]
|
||||
pub struct $color;
|
||||
impl fmt::Display for $color {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.as_ref())
|
||||
}
|
||||
}
|
||||
impl $color {
|
||||
#[allow(missing_docs)]
|
||||
#[inline]
|
||||
pub fn code() -> &'static str {
|
||||
concat!($code)
|
||||
}
|
||||
}
|
||||
impl AsRef<str> for $color {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &'static str {
|
||||
concat!("\x1b[", $code, "m")
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
define_color!(Reset, 0);
|
||||
define_color!(Bold, 1);
|
||||
define_color!(Underline, 4);
|
||||
|
||||
define_color!(Grey, 90);
|
||||
define_color!(Red, 91);
|
||||
define_color!(Green, 92);
|
||||
define_color!(Yellow, 93);
|
||||
define_color!(Blue, 94);
|
||||
define_color!(Magenta, 95);
|
||||
define_color!(Cyan, 96);
|
||||
define_color!(White, 97);
|
||||
|
||||
define_color!(Black, 30);
|
||||
define_color!(DarkRed, 31);
|
||||
define_color!(DarkGreen, 32);
|
||||
define_color!(DarkYellow, 33);
|
||||
define_color!(DarkBlue, 34);
|
||||
define_color!(DarkMagenta, 35);
|
||||
define_color!(DarkCyan, 36);
|
||||
define_color!(DarkWhite, 37);
|
||||
|
||||
define_color!(BlackBG, 40);
|
||||
define_color!(RedBG, 41);
|
||||
define_color!(GreenBG, 42);
|
||||
define_color!(YellowBG, 43);
|
||||
define_color!(BlueBG, 44);
|
||||
define_color!(MagentaBG, 45);
|
||||
define_color!(CyanBG, 46);
|
||||
define_color!(WhiteBG, 47);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn test_colors() {
|
||||
assert_eq!(color_string!("Error", Red), "\x1b[91mError\x1b[0m");
|
||||
assert_eq!(
|
||||
color_string!("Fancy Pants", Blue, Underline),
|
||||
"\x1b[94;4mFancy Pants\x1b[0m"
|
||||
);
|
||||
assert_eq!(
|
||||
color_string!("Super-duper-fancy-pants", Magenta, Underline, Bold, BlueBG),
|
||||
"\x1b[95;4;1;44mSuper-duper-fancy-pants\x1b[0m"
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
use std::{borrow::Cow, io::Result};
|
||||
|
||||
/// Encoding of Gopher response. Only UTF8 and CP437 are supported.
|
||||
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||
pub enum Encoding {
|
||||
/// Unicode
|
||||
UTF8,
|
||||
/// https://en.wikipedia.org/wiki/Code_page_437
|
||||
CP437,
|
||||
}
|
||||
|
||||
impl Default for Encoding {
|
||||
fn default() -> Self {
|
||||
Encoding::UTF8
|
||||
}
|
||||
}
|
||||
|
||||
impl Encoding {
|
||||
/// Accepts a string like "UTF8" or "CP437" and returns the
|
||||
/// appropriate `Encoding`, or an `Err`.
|
||||
pub fn from_str(s: &str) -> Result<Self> {
|
||||
match s.to_lowercase().as_ref() {
|
||||
"utf8" | "utf-8" | "utf 8" => Ok(Encoding::UTF8),
|
||||
"cp437" | "cp-437" | "cp 437" | "pc8" | "pc-8" | "oem us" | "oem-us" => {
|
||||
Ok(Encoding::CP437)
|
||||
}
|
||||
_ => Err(error!("Expected CP437 or UTF8 encoding")),
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert `response` into a String according to `encoding`.
|
||||
pub fn encode<'res>(&self, response: &'res [u8]) -> Cow<'res, str> {
|
||||
if matches!(self, Encoding::CP437) {
|
||||
let mut converted = String::with_capacity(response.len());
|
||||
for b in response {
|
||||
converted.push_str(cp437::convert_byte(b));
|
||||
}
|
||||
Cow::from(converted)
|
||||
} else {
|
||||
String::from_utf8_lossy(response)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,233 @@
|
||||
//! Terminal color scheme.
|
||||
//! Provides the Theme struct and functions/macros for making use of it.
|
||||
use std::fmt;
|
||||
|
||||
/// Provides a shortcut to the Reset color code.
|
||||
pub mod color {
|
||||
use std::fmt;
|
||||
|
||||
/// Can be used with fmt calls to reset to terminal defaults.
|
||||
pub struct Reset;
|
||||
|
||||
impl fmt::Display for Reset {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "\x1b[0m")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Use with push_str() or something.
|
||||
macro_rules! reset_color {
|
||||
() => {
|
||||
"\x1b[0m"
|
||||
};
|
||||
}
|
||||
|
||||
/// Color scheme for UI and menu items.
|
||||
#[derive(Debug)]
|
||||
pub struct Theme {
|
||||
// UI Colors
|
||||
/// The * cursor that appears next to the selected menu item.
|
||||
pub ui_cursor: String,
|
||||
/// The Number that appears to the left of a menu item.
|
||||
pub ui_number: String,
|
||||
/// The text in a menu.
|
||||
pub ui_menu: String,
|
||||
/// The color of the text content in a document.
|
||||
pub ui_text: String,
|
||||
|
||||
// Menu Item Colors
|
||||
/// Text document.
|
||||
pub item_text: String,
|
||||
/// Another menu.
|
||||
pub item_menu: String,
|
||||
/// Something went wrong.
|
||||
pub item_error: String,
|
||||
/// Gopher search prompt
|
||||
pub item_search: String,
|
||||
/// Telnet item. MUDs and stuff.
|
||||
pub item_telnet: String,
|
||||
/// External link. HTTP, usually.
|
||||
pub item_external: String,
|
||||
/// Binary file that can be downloaded to disk.
|
||||
pub item_download: String,
|
||||
/// Media that can be opened, like an image or mp3.
|
||||
pub item_media: String,
|
||||
/// An unknown or unsupported Gopher type.
|
||||
pub item_unsupported: String,
|
||||
}
|
||||
|
||||
impl Default for Theme {
|
||||
fn default() -> Theme {
|
||||
Theme {
|
||||
ui_cursor: to_color("white bold"),
|
||||
ui_number: to_color("magenta"),
|
||||
ui_menu: to_color("yellow"),
|
||||
ui_text: to_color("white"),
|
||||
|
||||
item_text: to_color("cyan"),
|
||||
item_menu: to_color("blue"),
|
||||
item_error: to_color("red"),
|
||||
item_search: to_color("white"),
|
||||
item_telnet: to_color("grey"),
|
||||
item_external: to_color("green"),
|
||||
item_download: to_color("white underline"),
|
||||
item_media: to_color("green underline"),
|
||||
item_unsupported: to_color("whitebg red"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Theme {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"# phetch theme
|
||||
ui.cursor {ui_cursor}
|
||||
ui.number {ui_number}
|
||||
ui.menu {ui_menu}
|
||||
ui.text {ui_text}
|
||||
|
||||
item.text {item_text}
|
||||
item.menu {item_menu}
|
||||
item.error {item_error}
|
||||
item.search {item_search}
|
||||
item.telnet {item_telnet}
|
||||
item.external {item_external}
|
||||
item.download {item_download}
|
||||
item.media {item_media}
|
||||
item.unsupported {item_unsupported}",
|
||||
ui_cursor = to_words(&self.ui_cursor),
|
||||
ui_number = to_words(&self.ui_number),
|
||||
ui_menu = to_words(&self.ui_menu),
|
||||
ui_text = to_words(&self.ui_text),
|
||||
item_text = to_words(&self.item_text),
|
||||
item_menu = to_words(&self.item_menu),
|
||||
item_error = to_words(&self.item_error),
|
||||
item_search = to_words(&self.item_search),
|
||||
item_telnet = to_words(&self.item_telnet),
|
||||
item_external = to_words(&self.item_external),
|
||||
item_download = to_words(&self.item_download),
|
||||
item_media = to_words(&self.item_media),
|
||||
item_unsupported = to_words(&self.item_unsupported),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert a string like "blue underline" or "red" into a color code.
|
||||
pub fn to_color<S: AsRef<str>>(line: S) -> String {
|
||||
if *crate::NO_COLOR {
|
||||
return "".into();
|
||||
}
|
||||
|
||||
let parts = line.as_ref().split(' ').collect::<Vec<_>>();
|
||||
|
||||
if parts.is_empty() {
|
||||
return "".into();
|
||||
}
|
||||
|
||||
let mut out = String::from("\x1b[");
|
||||
let len = parts.len();
|
||||
|
||||
for (i, part) in parts.iter().enumerate() {
|
||||
out.push_str(&color_code(part).to_string());
|
||||
if i < len - 1 {
|
||||
out.push(';');
|
||||
}
|
||||
}
|
||||
out.push('m');
|
||||
|
||||
out
|
||||
}
|
||||
|
||||
/// Convert color code like "\x1b[91m" into something like "red"
|
||||
pub fn to_words<S: AsRef<str>>(code: S) -> String {
|
||||
code.as_ref()
|
||||
.replace("\x1b[", "")
|
||||
.replace('m', "")
|
||||
.split(';')
|
||||
.map(color_word)
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ")
|
||||
}
|
||||
|
||||
fn color_code(color: &str) -> usize {
|
||||
match color {
|
||||
"bold" => 1,
|
||||
"underline" => 4,
|
||||
"grey" => 90,
|
||||
"red" => 91,
|
||||
"green" => 92,
|
||||
"yellow" => 93,
|
||||
"blue" => 94,
|
||||
"magenta" => 95,
|
||||
"cyan" => 96,
|
||||
"white" => 97,
|
||||
"black" => 30,
|
||||
"darkred" => 31,
|
||||
"darkgreen" => 32,
|
||||
"darkyellow" => 33,
|
||||
"darkblue" => 34,
|
||||
"darkmagenta" => 35,
|
||||
"darkcyan" => 36,
|
||||
"darkwhite" => 37,
|
||||
"blackbg" => 40,
|
||||
"redbg" => 41,
|
||||
"greenbg" => 42,
|
||||
"yellowbg" => 43,
|
||||
"bluebg" => 44,
|
||||
"magentabg" => 45,
|
||||
"cyanbg" => 46,
|
||||
"whitebg" => 47,
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn color_word(code: &str) -> &'static str {
|
||||
match code {
|
||||
"1" => "bold",
|
||||
"4" => "underline",
|
||||
"90" => "grey",
|
||||
"91" => "red",
|
||||
"92" => "green",
|
||||
"93" => "yellow",
|
||||
"94" => "blue",
|
||||
"95" => "magenta",
|
||||
"96" => "cyan",
|
||||
"97" => "white",
|
||||
"30" => "black",
|
||||
"31" => "darkred",
|
||||
"32" => "darkgreen",
|
||||
"33" => "darkyellow",
|
||||
"34" => "darkblue",
|
||||
"35" => "darkmagenta",
|
||||
"36" => "darkcyan",
|
||||
"37" => "darkwhite",
|
||||
"40" => "blackbg",
|
||||
"41" => "redbg",
|
||||
"42" => "greenbg",
|
||||
"43" => "yellowbg",
|
||||
"44" => "bluebg",
|
||||
"45" => "magentabg",
|
||||
"46" => "cyanbg",
|
||||
"47" => "whitebg",
|
||||
_ => "white",
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_color_scheme() {
|
||||
let mut theme = Theme::default();
|
||||
theme.ui_cursor = to_color("bold").into();
|
||||
theme.ui_menu = to_color("red").into();
|
||||
theme.item_menu = to_color("blue underline").into();
|
||||
|
||||
assert_eq!("\u{1b}[1m", theme.ui_cursor);
|
||||
assert_eq!("\u{1b}[91m", theme.ui_menu);
|
||||
assert_eq!("\u{1b}[94;4m", theme.item_menu);
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,15 @@
|
||||
# phetch theme
|
||||
ui.cursor red
|
||||
ui.number white
|
||||
ui.menu cyan
|
||||
ui.text white
|
||||
|
||||
item.text magenta
|
||||
item.menu magenta
|
||||
item.error red
|
||||
item.search magenta
|
||||
item.telnet magenta
|
||||
item.external magenta
|
||||
item.download magenta underline
|
||||
item.media magenta underline
|
||||
item.unsupported magentabg white
|
@ -0,0 +1,14 @@
|
||||
# phetch default theme
|
||||
ui.cursor white bold
|
||||
ui.number magenta
|
||||
ui.menu yellow
|
||||
ui.text white
|
||||
item.text cyan
|
||||
item.menu blue
|
||||
item.error red
|
||||
item.search white
|
||||
item.telnet grey
|
||||
item.external green
|
||||
item.download white underline
|
||||
item.media green underline
|
||||
item.unsupported whitebg red
|
@ -0,0 +1,15 @@
|
||||
# phetch light theme
|
||||
ui.cursor black bold
|
||||
ui.number magenta
|
||||
ui.menu darkyellow
|
||||
ui.text black
|
||||
|
||||
item.text darkcyan
|
||||
item.menu blue
|
||||
item.error red
|
||||
item.search black
|
||||
item.telnet grey
|
||||
item.external darkgreen
|
||||
item.download black underline
|
||||
item.media darkgreen underline
|
||||
item.unsupported redbg white
|
@ -0,0 +1,15 @@
|
||||
# phetch matrix theme
|
||||
ui.cursor yellow
|
||||
ui.number grey
|
||||
ui.menu green
|
||||
ui.text green
|
||||
|
||||
item.text green
|
||||
item.menu green
|
||||
item.error red
|
||||
item.search green
|
||||
item.telnet green
|
||||
item.external green
|
||||
item.download green underline
|
||||
item.media green underline
|
||||
item.unsupported magentabg white
|
@ -0,0 +1,15 @@
|
||||
# phetch vaporwave(ish) theme
|
||||
ui.cursor red
|
||||
ui.number white
|
||||
ui.menu cyan
|
||||
ui.text white
|
||||
|
||||
item.text magenta
|
||||
item.menu magenta
|
||||
item.error red
|
||||
item.search magenta
|
||||
item.telnet magenta
|
||||
item.external magenta
|
||||
item.download magenta underline
|
||||
item.media magenta underline
|
||||
item.unsupported magentabg white
|
@ -0,0 +1,15 @@
|
||||
# phetch web theme
|
||||
ui.cursor white bold
|
||||
ui.number white
|
||||
ui.menu white
|
||||
ui.text white
|
||||
|
||||
item.text blue underline
|
||||
item.menu blue underline
|
||||
item.error red
|
||||
item.search blue underline
|
||||
item.telnet blue underline
|
||||
item.external blue underline
|
||||
item.download blue underline
|
||||
item.media blue underline
|
||||
item.unsupported whitebg red
|
Loading…
Reference in New Issue