diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/colored | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/colored')
-rw-r--r-- | vendor/colored/.cargo-checksum.json | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/CHANGELOG.md | 15 | ||||
-rw-r--r-- | vendor/colored/Cargo.lock | 171 | ||||
-rw-r--r-- | vendor/colored/Cargo.toml | 38 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/Dockerfile | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/LICENSE | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/README.md | 28 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/examples/control.rs | 1 | ||||
-rw-r--r-- | vendor/colored/examples/custom_colors.rs | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/examples/dynamic_colors.rs | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/examples/most_simple.rs | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/examples/nested_colors.rs | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/src/color.rs | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/src/control.rs | 26 | ||||
-rw-r--r-- | vendor/colored/src/customcolors.rs | 28 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/src/formatters.rs | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/src/lib.rs | 33 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/src/style.rs | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/colored/tests/ansi_term_compat.rs | 0 |
19 files changed, 265 insertions, 85 deletions
diff --git a/vendor/colored/.cargo-checksum.json b/vendor/colored/.cargo-checksum.json index a2730e5b2..ba2ccde5e 100644 --- a/vendor/colored/.cargo-checksum.json +++ b/vendor/colored/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"08d00cec58e4444b8d58267705aa4b8b8be6cb404dbac396a343ea71857fae96","Cargo.lock":"0a241b71934585d26ec03d6c265b1dbb69971bbfcd4b319a23e28d6cd3581007","Cargo.toml":"fa84955c09e271f41dd86b55a3738f9d3b1fb419dad4fd1b3242e5d3dac75cc1","Dockerfile":"e57d9b655c28d967c6b1b46a1db2e434ea9a4dc55fe1635add74b00265bb3153","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"0807a71aaca98bb5ff5911df7f13305d6a59434b72130c3c54b37b508abc322a","examples/control.rs":"10d95f75d0556c6355d9980007119a11922aff0ebe1809c146e12367bca54955","examples/dynamic_colors.rs":"3bfb4353a665d898be947159e6715d05b911ddab9cfbf650d122c20894935371","examples/most_simple.rs":"9110a7cf8e176dc60653e2a4e4358afdbd72c7ac2dad5cb1fe8fd4b7739211da","examples/nested_colors.rs":"37345018ed494e26ae06c9641039286d967154c795ccaa3ec8dd6b6148f58765","src/color.rs":"4809203b30403689f7befdc4c0371ad732a3d78718ccb0eeb20905034c5feeab","src/control.rs":"8105be4165fa073e65d2851004ecdc5d1b8c69b29f38274ef11b7c83e64cfefe","src/formatters.rs":"77dcc511626c9df54851d9ac2352e80ece7e6e9309f299357ef0e3737c33402d","src/lib.rs":"56a9d56f58464a292316d926265bb1b47c398f5dd82fb02b22a650ef45839dac","src/style.rs":"90ad40942e0f5efe32615c628782e9fa4fa0f98101bad073dda3f687cff2389d","tests/ansi_term_compat.rs":"5658c3d0de456c23ffdca07c92d6a931a7ab3c6ac563417fccb54808cb2d6166"},"package":"b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"911a414acbb19ed3f96c70745ae5985444c51d5feab1a6fce1a959954370a17c","Cargo.lock":"93ecf0221c79aea1ff505c8995bc54d8f887252ea0088106f0c73c10d6a2b058","Cargo.toml":"3284f1e48587789ea6dd6ca7aa639d6508f2f20f36dbcaa384588ce946398569","Dockerfile":"e57d9b655c28d967c6b1b46a1db2e434ea9a4dc55fe1635add74b00265bb3153","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"6c7a06ea6f79320783371e0285c1c683d71f911166887747ea8ae38051ba1204","examples/control.rs":"fdd0567d9a2aaea0c3910c21837df39d9560fbb309f6050ebe8f76ff40becf4d","examples/custom_colors.rs":"deaceb2a12869fd2deeefec4d3ed4ab587979b4cbd606f43ee8f4e650c2b52ee","examples/dynamic_colors.rs":"3bfb4353a665d898be947159e6715d05b911ddab9cfbf650d122c20894935371","examples/most_simple.rs":"9110a7cf8e176dc60653e2a4e4358afdbd72c7ac2dad5cb1fe8fd4b7739211da","examples/nested_colors.rs":"37345018ed494e26ae06c9641039286d967154c795ccaa3ec8dd6b6148f58765","src/color.rs":"4809203b30403689f7befdc4c0371ad732a3d78718ccb0eeb20905034c5feeab","src/control.rs":"b35607f90d5a6127128ebe58208b75169da2731de839bf86809e0eea806470d3","src/customcolors.rs":"2d865acc802fe9bb5e06d8d4b3795763f7e4a8fb6797af28d14e99e096cba9d0","src/formatters.rs":"77dcc511626c9df54851d9ac2352e80ece7e6e9309f299357ef0e3737c33402d","src/lib.rs":"88f76fe3b16403d69fe01da48f7a72520407a09610f235f6c70c4ce321172567","src/style.rs":"35efab427a79f1787b2f7588685a652c78cdcca28ce7cc3eee6723e0c2001f47","tests/ansi_term_compat.rs":"5658c3d0de456c23ffdca07c92d6a931a7ab3c6ac563417fccb54808cb2d6166"},"package":"2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6"}
\ No newline at end of file diff --git a/vendor/colored/CHANGELOG.md b/vendor/colored/CHANGELOG.md index f74427e8f..e8739254c 100755..100644 --- a/vendor/colored/CHANGELOG.md +++ b/vendor/colored/CHANGELOG.md @@ -1,3 +1,18 @@ +# Unreleased + +# 2.0.4 +- Switch from `winapi` to `windows-sys`. + +# 2.0.3 +- Document crate MSRV of `1.63`. + +# 2.0.2 +- Fix typo in `src/control.rs`. +- Replace `atty` dependency with `is-terminal`. + +# 2.0.1 (July 3, 2023) +- Add edition for future compatibility. +- Implement custom colors that can be stored in a variable. # 2.0.0 (July 14, 2020) - Add support for true colours. diff --git a/vendor/colored/Cargo.lock b/vendor/colored/Cargo.lock index f80ec9f3a..d6e018b0b 100644 --- a/vendor/colored/Cargo.lock +++ b/vendor/colored/Cargo.lock @@ -1,83 +1,198 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ansi_term" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "colored" +version = "2.0.4" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "is-terminal", + "lazy_static", + "rspec", + "windows-sys", ] [[package]] -name = "atty" -version = "0.2.14" +name = "errno" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ - "hermit-abi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "errno-dragonfly", + "libc", + "windows-sys", ] [[package]] -name = "colored" -version = "2.0.0" +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", - "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)", - "rspec 1.0.0-beta.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "libc", ] [[package]] name = "hermit-abi" -version = "0.1.15" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "is-terminal" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" dependencies = [ - "libc 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "rustix", + "windows-sys", ] [[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.72" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "rspec" version = "1.0.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "292964ba6cf097dd3a1fc94c286c8eabf74a0afe709d059d2370e4f1fc766ae2" + +[[package]] +name = "rustix" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabcb0461ebd01d6b79945797c27f8529082226cb630a9865a71870ff63532a4" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 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-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" -[metadata] -"checksum ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum hermit-abi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" -"checksum rspec 1.0.0-beta.3 (registry+https://github.com/rust-lang/crates.io-index)" = "292964ba6cf097dd3a1fc94c286c8eabf74a0afe709d059d2370e4f1fc766ae2" -"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -"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" +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" diff --git a/vendor/colored/Cargo.toml b/vendor/colored/Cargo.toml index 3a6b59be6..dda29513f 100644 --- a/vendor/colored/Cargo.toml +++ b/vendor/colored/Cargo.toml @@ -3,28 +3,37 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] +edition = "2021" +rust-version = "1.63" name = "colored" -version = "2.0.0" +version = "2.0.4" authors = ["Thomas Wickham <mackwic@gmail.com>"] description = "The most simple way to add colors in your terminal" homepage = "https://github.com/mackwic/colored" readme = "README.md" -keywords = ["color", "string", "term", "ansi_term", "term-painter"] +keywords = [ + "color", + "string", + "term", + "ansi_term", + "term-painter", +] license = "MPL-2.0" repository = "https://github.com/mackwic/colored" -[dependencies.atty] -version = "0.2" + +[dependencies.is-terminal] +version = "0.4" [dependencies.lazy_static] version = "1" + [dev-dependencies.ansi_term] version = "0.12" @@ -33,7 +42,10 @@ version = "=1.0.0-beta.3" [features] no-color = [] -[target."cfg(windows)".dependencies.winapi] -version = "0.3" -features = ["consoleapi", "processenv", "winbase"] -default-features = false + +[target."cfg(windows)".dependencies.windows-sys] +version = "0.48" +features = [ + "Win32_Foundation", + "Win32_System_Console", +] diff --git a/vendor/colored/Dockerfile b/vendor/colored/Dockerfile index 1bc5ba71b..1bc5ba71b 100755..100644 --- a/vendor/colored/Dockerfile +++ b/vendor/colored/Dockerfile diff --git a/vendor/colored/LICENSE b/vendor/colored/LICENSE index 14e2f777f..14e2f777f 100755..100644 --- a/vendor/colored/LICENSE +++ b/vendor/colored/LICENSE diff --git a/vendor/colored/README.md b/vendor/colored/README.md index 5d508e793..03beb2ab2 100755..100644 --- a/vendor/colored/README.md +++ b/vendor/colored/README.md @@ -1,7 +1,6 @@ # Colored -[![Build -Status](https://travis-ci.org/mackwic/colored.svg?branch=master)](https://travis-ci.org/mackwic/colored) [![Crates.io](https://img.shields.io/crates/v/colored.svg?maxAge=2592000)](https://crates.io/crates/colored) [![Crates.io](https://img.shields.io/crates/l/colored.svg?maxAge=2592000)](https://github.com/mackwic/colored/blob/master/LICENSE) +[![Crates.io](https://img.shields.io/crates/v/colored.svg?maxAge=2592000)](https://crates.io/crates/colored) [![Crates.io](https://img.shields.io/crates/l/colored.svg?maxAge=2592000)](https://github.com/mackwic/colored/blob/master/LICENSE) Coloring terminal so simple, you already know how to do it! @@ -37,7 +36,7 @@ colored = "2" and add this to your `lib.rs` or `main.rs`: ```rust - extern crate colored; // not needed in Rust 2018 + extern crate colored; // not needed in Rust 2018+ use colored::*; @@ -127,25 +126,6 @@ dumb_terminal = ["colored/no-color"] You can use have even finer control by using the `colored::control::set_override` method. -## Build with Docker - -### Install Docker - -Use the install instructions located [here](https://docs.docker.com/v17.12/install/) - -### Build the Docker image - -```docker build -t colored_image .``` - -### Build the library - -```docker run --rm -it -v "$PWD":/src -u `id -u`:`id -g` colored_image /bin/bash -c "cargo build"``` - -### Test the library - -```docker run --rm -it -v "$PWD":/src -u `id -u`:`id -g` colored_image /bin/bash -c "cargo test"``` - - ## Todo - **More tests ?**: We always welcome more tests! Please contribute! @@ -158,6 +138,9 @@ Thanks for the [ansi\_term crate](https://github.com/ogham/rust-ansi-term) for providing a reference implementation, which greatly helped making this crate output correct strings. +## Minimum Supported Rust Version (MSRV) +The current MSRV is `1.63`, which is checked and enforced automatically via CI. This version may change in the future in minor version bumps, so if you require a specific Rust version you should use a restricted version requirement such as `~X.Y`. + ## License [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/). See the @@ -175,6 +158,7 @@ In non legal terms it means that: ## Contributors - Thomas Wickham: [@mackwic](https://github.com/mackwic) +- Hunter Wittenborn [@hwittenborn](https://github.com/hwittenborn) - Corey "See More" Richardson: [@cmr](https://github.com/cmr) - Iban Eguia: [@Razican](https://github.com/Razican) - Alexis "Horgix" Chotard: [@horgix](https://github.com/horgix) diff --git a/vendor/colored/examples/control.rs b/vendor/colored/examples/control.rs index b50b42691..14a7b762c 100755..100644 --- a/vendor/colored/examples/control.rs +++ b/vendor/colored/examples/control.rs @@ -1,3 +1,4 @@ +#![allow(unused_must_use)] extern crate colored; use colored::*; diff --git a/vendor/colored/examples/custom_colors.rs b/vendor/colored/examples/custom_colors.rs new file mode 100644 index 000000000..05c588e60 --- /dev/null +++ b/vendor/colored/examples/custom_colors.rs @@ -0,0 +1,6 @@ +use colored::*; +fn main() { + let my_color = CustomColor::new(0, 120, 120); + println!("{}", "Greetings from Ukraine".custom_color(my_color)); + println!("{}", "Slava Ukraini!".on_custom_color(my_color)); +} diff --git a/vendor/colored/examples/dynamic_colors.rs b/vendor/colored/examples/dynamic_colors.rs index d9861f425..d9861f425 100755..100644 --- a/vendor/colored/examples/dynamic_colors.rs +++ b/vendor/colored/examples/dynamic_colors.rs diff --git a/vendor/colored/examples/most_simple.rs b/vendor/colored/examples/most_simple.rs index b94a2b36a..b94a2b36a 100755..100644 --- a/vendor/colored/examples/most_simple.rs +++ b/vendor/colored/examples/most_simple.rs diff --git a/vendor/colored/examples/nested_colors.rs b/vendor/colored/examples/nested_colors.rs index de1124916..de1124916 100755..100644 --- a/vendor/colored/examples/nested_colors.rs +++ b/vendor/colored/examples/nested_colors.rs diff --git a/vendor/colored/src/color.rs b/vendor/colored/src/color.rs index 6e544e8fd..6e544e8fd 100755..100644 --- a/vendor/colored/src/color.rs +++ b/vendor/colored/src/color.rs diff --git a/vendor/colored/src/control.rs b/vendor/colored/src/control.rs index 7ad6e621e..80c82549c 100755..100644 --- a/vendor/colored/src/control.rs +++ b/vendor/colored/src/control.rs @@ -1,7 +1,9 @@ //! A couple of functions to enable and disable coloring. +use is_terminal::IsTerminal; use std::default::Default; use std::env; +use std::io; use std::sync::atomic::{AtomicBool, Ordering}; /// Sets a flag to the console to use a virtual terminal environment. @@ -19,26 +21,22 @@ use std::sync::atomic::{AtomicBool, Ordering}; /// ```rust /// use colored::*; /// control::set_virtual_terminal(false).unwrap(); -/// println!("{}", "bright cyan".bright_cyan()); // will print '[96mbright cyan[0m' on windows 10 +/// println!("{}", "bright cyan".bright_cyan()); // will print '[96mbright cyan[0m' on windows 10 /// /// control::set_virtual_terminal(true).unwrap(); -/// println!("{}", "bright cyan".bright_cyan()); // will print correctly +/// println!("{}", "bright cyan".bright_cyan()); // will print correctly /// ``` +#[allow(clippy::result_unit_err)] #[cfg(windows)] pub fn set_virtual_terminal(use_virtual: bool) -> Result<(), ()> { - use winapi::{ - shared::minwindef::DWORD, - um::{ - consoleapi::{GetConsoleMode, SetConsoleMode}, - processenv::GetStdHandle, - winbase::STD_OUTPUT_HANDLE, - wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING, - }, + use windows_sys::Win32::System::Console::{ + GetConsoleMode, GetStdHandle, SetConsoleMode, ENABLE_VIRTUAL_TERMINAL_PROCESSING, + STD_OUTPUT_HANDLE, }; unsafe { let handle = GetStdHandle(STD_OUTPUT_HANDLE); - let mut original_mode: DWORD = 0; + let mut original_mode = 0; GetConsoleMode(handle, &mut original_mode); let enabled = original_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING @@ -60,7 +58,7 @@ pub fn set_virtual_terminal(use_virtual: bool) -> Result<(), ()> { Ok(()) } -/// A flag to to if coloring should occur. +/// A flag for whether coloring should occur. pub struct ShouldColorize { clicolor: bool, clicolor_force: Option<bool>, @@ -104,8 +102,8 @@ impl ShouldColorize { /// followed by `CLICOLOR` combined with tty check. pub fn from_env() -> Self { ShouldColorize { - clicolor: ShouldColorize::normalize_env(env::var("CLICOLOR")).unwrap_or_else(|| true) - && atty::is(atty::Stream::Stdout), + clicolor: ShouldColorize::normalize_env(env::var("CLICOLOR")).unwrap_or(true) + && io::stdout().is_terminal(), clicolor_force: ShouldColorize::resolve_clicolor_force( env::var("NO_COLOR"), env::var("CLICOLOR_FORCE"), diff --git a/vendor/colored/src/customcolors.rs b/vendor/colored/src/customcolors.rs new file mode 100644 index 000000000..896e92f9d --- /dev/null +++ b/vendor/colored/src/customcolors.rs @@ -0,0 +1,28 @@ +/// Custom color structure, it will generate a true color in the result +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct CustomColor { + /// Red + pub r: u8, + /// Green + pub g: u8, + /// Blue + pub b: u8, +} + +/// This only makes custom color creation easier. +impl CustomColor { + /// Create a new custom color + pub fn new(r: u8, g: u8, b: u8) -> Self { + Self { r, g, b } + } +} + +#[cfg(test)] +mod tests { + use crate::*; + #[test] + fn main() { + let my_color = CustomColor::new(0, 120, 120); + println!("{}", "Greetings from Ukraine".custom_color(my_color)); + } +} diff --git a/vendor/colored/src/formatters.rs b/vendor/colored/src/formatters.rs index 56d5db0d8..56d5db0d8 100755..100644 --- a/vendor/colored/src/formatters.rs +++ b/vendor/colored/src/formatters.rs diff --git a/vendor/colored/src/lib.rs b/vendor/colored/src/lib.rs index 4475320fc..71e042b44 100755..100644 --- a/vendor/colored/src/lib.rs +++ b/vendor/colored/src/lib.rs @@ -25,11 +25,9 @@ //! #![warn(missing_docs)] -extern crate atty; +extern crate is_terminal; #[macro_use] extern crate lazy_static; -#[cfg(windows)] -extern crate winapi; #[cfg(test)] extern crate rspec; @@ -38,6 +36,11 @@ mod color; pub mod control; mod style; +pub use self::customcolors::CustomColor; + +/// Custom colors support. +pub mod customcolors; + pub use color::*; use std::{borrow::Cow, fmt, ops::Deref}; @@ -174,6 +177,16 @@ pub trait Colorize { { self.color(Color::TrueColor { r, g, b }) } + fn custom_color(self, color: CustomColor) -> ColoredString + where + Self: Sized, + { + self.color(Color::TrueColor { + r: color.r, + g: color.g, + b: color.b, + }) + } fn color<S: Into<Color>>(self, color: S) -> ColoredString; // Background Colors fn on_black(self) -> ColoredString @@ -290,6 +303,16 @@ pub trait Colorize { { self.on_color(Color::TrueColor { r, g, b }) } + fn on_custom_color(self, color: CustomColor) -> ColoredString + where + Self: Sized, + { + self.on_color(Color::TrueColor { + r: color.r, + g: color.g, + b: color.b, + }) + } fn on_color<S: Into<Color>>(self, color: S) -> ColoredString; // Styles fn clear(self) -> ColoredString; @@ -299,10 +322,8 @@ pub trait Colorize { fn italic(self) -> ColoredString; fn underline(self) -> ColoredString; fn blink(self) -> ColoredString; - /// Historical name of `Colorize::reversed`. May be removed in a future version. Please use - /// `Colorize::reversed` instead + #[deprecated(since = "1.5.2", note = "Users should use reversed instead")] fn reverse(self) -> ColoredString; - /// This should be preferred to `Colorize::reverse`. fn reversed(self) -> ColoredString; fn hidden(self) -> ColoredString; fn strikethrough(self) -> ColoredString; diff --git a/vendor/colored/src/style.rs b/vendor/colored/src/style.rs index bf97acc99..8588554f0 100755..100644 --- a/vendor/colored/src/style.rs +++ b/vendor/colored/src/style.rs @@ -75,7 +75,7 @@ impl Styles { let res: Vec<Styles> = STYLES .iter() - .filter(|&&(ref mask, _)| (0 != (u & mask))) + .filter(|&(mask, _)| (0 != (u & mask))) .map(|&(_, value)| value) .collect(); if res.is_empty() { diff --git a/vendor/colored/tests/ansi_term_compat.rs b/vendor/colored/tests/ansi_term_compat.rs index 6683ee0c8..6683ee0c8 100755..100644 --- a/vendor/colored/tests/ansi_term_compat.rs +++ b/vendor/colored/tests/ansi_term_compat.rs |