From a990de90fe41456a23e58bd087d2f107d321f3a1 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Fri, 19 Jul 2024 16:37:58 +0400 Subject: Deleted vendor folder --- vendor/anstyle-wincon/.cargo-checksum.json | 1 - vendor/anstyle-wincon/Cargo.lock | 90 --------- vendor/anstyle-wincon/Cargo.toml | 94 --------- vendor/anstyle-wincon/LICENSE-APACHE | 202 -------------------- vendor/anstyle-wincon/LICENSE-MIT | 19 -- vendor/anstyle-wincon/README.md | 30 --- vendor/anstyle-wincon/examples/dump-wincon.rs | 139 -------------- vendor/anstyle-wincon/examples/set-wincon.rs | 58 ------ vendor/anstyle-wincon/src/ansi.rs | 25 --- vendor/anstyle-wincon/src/lib.rs | 18 -- vendor/anstyle-wincon/src/stream.rs | 178 ----------------- vendor/anstyle-wincon/src/windows.rs | 263 -------------------------- 12 files changed, 1117 deletions(-) delete mode 100644 vendor/anstyle-wincon/.cargo-checksum.json delete mode 100644 vendor/anstyle-wincon/Cargo.lock delete mode 100644 vendor/anstyle-wincon/Cargo.toml delete mode 100644 vendor/anstyle-wincon/LICENSE-APACHE delete mode 100644 vendor/anstyle-wincon/LICENSE-MIT delete mode 100644 vendor/anstyle-wincon/README.md delete mode 100644 vendor/anstyle-wincon/examples/dump-wincon.rs delete mode 100644 vendor/anstyle-wincon/examples/set-wincon.rs delete mode 100644 vendor/anstyle-wincon/src/ansi.rs delete mode 100644 vendor/anstyle-wincon/src/lib.rs delete mode 100644 vendor/anstyle-wincon/src/stream.rs delete mode 100644 vendor/anstyle-wincon/src/windows.rs (limited to 'vendor/anstyle-wincon') diff --git a/vendor/anstyle-wincon/.cargo-checksum.json b/vendor/anstyle-wincon/.cargo-checksum.json deleted file mode 100644 index 63712e8..0000000 --- a/vendor/anstyle-wincon/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.lock":"3cc0f5705ebb0bb446d6f88f71832d2db70bee8c78a545343a755e2a969212a3","Cargo.toml":"5a090b294286cb22bed379e818f8657da219f62fe0e1e8eb21e91aaaf875c139","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"73b0d84e4b954ce904a00043379767ae2a5f8d4f40564639cee230f639fe4dae","README.md":"513a578c6c2ea39a811e2038358e512cbc0c709e3a7c18303871ec2c52ebbeec","examples/dump-wincon.rs":"bd0ffadd14eed711fc74d64caff5ce98bb5c5b3f0b313b54ac759b5a6c6a289b","examples/set-wincon.rs":"b8bc444537449bf334a1e26dd010986c16cb260567f87ae9597fc869c936fe6a","src/ansi.rs":"1b0166d064fe261bc012acca2f3ff442703a774e5fa4b8e96f63dce87b7e73d1","src/lib.rs":"4b4415a0684901bab712dbe94aec960792760aa1db5505adacfdc43db2cd93a7","src/stream.rs":"afdbd6e314127bd412e81894a857cb95fe3140e2b994e17e4e5580ef113a4159","src/windows.rs":"e4aeae1b32f6348b6b9c54e0cd54d9a3c08c6f250c7313fcaa59e3d8a8f51c97"},"package":"1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"} \ No newline at end of file diff --git a/vendor/anstyle-wincon/Cargo.lock b/vendor/anstyle-wincon/Cargo.lock deleted file mode 100644 index b54c8cd..0000000 --- a/vendor/anstyle-wincon/Cargo.lock +++ /dev/null @@ -1,90 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "anstyle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" - -[[package]] -name = "anstyle-wincon" -version = "3.0.2" -dependencies = [ - "anstyle", - "lexopt", - "windows-sys", -] - -[[package]] -name = "lexopt" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baff4b617f7df3d896f97fe922b64817f6cd9a756bb81d40f8883f2f66dcb401" - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -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.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/vendor/anstyle-wincon/Cargo.toml b/vendor/anstyle-wincon/Cargo.toml deleted file mode 100644 index 137188d..0000000 --- a/vendor/anstyle-wincon/Cargo.toml +++ /dev/null @@ -1,94 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# 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. -# -# 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.70.0" -name = "anstyle-wincon" -version = "3.0.2" -include = [ - "build.rs", - "src/**/*", - "Cargo.toml", - "Cargo.lock", - "LICENSE*", - "README.md", - "benches/**/*", - "examples/**/*", -] -description = "Styling legacy Windows terminals" -homepage = "https://github.com/rust-cli/anstyle" -readme = "README.md" -keywords = [ - "ansi", - "terminal", - "color", - "windows", -] -categories = ["command-line-interface"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rust-cli/anstyle.git" - -[package.metadata.docs.rs] -features = [] -rustdoc-args = [ - "--cfg", - "docsrs", -] -targets = ["x86_64-pc-windows-msvc"] - -[[package.metadata.release.pre-release-replacements]] -file = "CHANGELOG.md" -min = 1 -replace = "{{version}}" -search = "Unreleased" - -[[package.metadata.release.pre-release-replacements]] -exactly = 1 -file = "CHANGELOG.md" -replace = "...{{tag_name}}" -search = '\.\.\.HEAD' - -[[package.metadata.release.pre-release-replacements]] -file = "CHANGELOG.md" -min = 1 -replace = "{{date}}" -search = "ReleaseDate" - -[[package.metadata.release.pre-release-replacements]] -exactly = 1 -file = "CHANGELOG.md" -replace = """ - -## [Unreleased] - ReleaseDate -""" -search = "" - -[[package.metadata.release.pre-release-replacements]] -exactly = 1 -file = "CHANGELOG.md" -replace = """ - -[Unreleased]: https://github.com/rust-cli/anstyle/compare/{{tag_name}}...HEAD""" -search = "" - -[dependencies.anstyle] -version = "1.0.0" - -[dev-dependencies.lexopt] -version = "0.3.0" - -[target."cfg(windows)".dependencies.windows-sys] -version = "0.52.0" -features = [ - "Win32_System_Console", - "Win32_Foundation", -] diff --git a/vendor/anstyle-wincon/LICENSE-APACHE b/vendor/anstyle-wincon/LICENSE-APACHE deleted file mode 100644 index 8f71f43..0000000 --- a/vendor/anstyle-wincon/LICENSE-APACHE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/vendor/anstyle-wincon/LICENSE-MIT b/vendor/anstyle-wincon/LICENSE-MIT deleted file mode 100644 index fe451c9..0000000 --- a/vendor/anstyle-wincon/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 Josh Triplett, 2022 The rust-cli Developers - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/anstyle-wincon/README.md b/vendor/anstyle-wincon/README.md deleted file mode 100644 index 7df0db5..0000000 --- a/vendor/anstyle-wincon/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# anstyle-wincon - -> Styling legacy Windows terminals - -[![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation] -![License](https://img.shields.io/crates/l/anstyle-wincon.svg) -[![Crates Status](https://img.shields.io/crates/v/anstyle-wincon.svg)](https://crates.io/crates/anstyle-wincon) - -## License - -Licensed under either of - - * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) - * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) - -at your option. - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally -submitted for inclusion in the work by you, as defined in the Apache-2.0 -license, shall be dual licensed as above, without any additional terms or -conditions. - -### Special Thanks - -[burntsushi](https://github.com/burntsushi) for [termcolor](https://github.com/burntsushi/termcolor) as I don't know Windows either :) - -[Crates.io]: https://crates.io/crates/anstyle-wincon -[Documentation]: https://docs.rs/anstyle-wincon diff --git a/vendor/anstyle-wincon/examples/dump-wincon.rs b/vendor/anstyle-wincon/examples/dump-wincon.rs deleted file mode 100644 index bb80bf4..0000000 --- a/vendor/anstyle-wincon/examples/dump-wincon.rs +++ /dev/null @@ -1,139 +0,0 @@ -use anstyle_wincon::WinconStream as _; - -fn main() -> Result<(), lexopt::Error> { - let args = Args::parse()?; - let stdout = std::io::stdout(); - let mut stdout = stdout.lock(); - - for fixed in 0..16 { - let style = style(fixed, args.layer, args.effects); - let _ = print_number(&mut stdout, fixed, style); - if fixed == 7 || fixed == 15 { - let _ = stdout.write_colored(None, None, &b"\n"[..]); - } - } - - for r in 0..6 { - let _ = stdout.write_colored(None, None, &b"\n"[..]); - for g in 0..6 { - for b in 0..6 { - let fixed = r * 36 + g * 6 + b + 16; - let style = style(fixed, args.layer, args.effects); - let _ = print_number(&mut stdout, fixed, style); - } - let _ = stdout.write_colored(None, None, &b"\n"[..]); - } - } - - for c in 0..24 { - if 0 == c % 8 { - let _ = stdout.write_colored(None, None, &b"\n"[..]); - } - let fixed = 232 + c; - let style = style(fixed, args.layer, args.effects); - let _ = print_number(&mut stdout, fixed, style); - } - - Ok(()) -} - -fn style(fixed: u8, layer: Layer, effects: anstyle::Effects) -> anstyle::Style { - let color = anstyle::Ansi256Color(fixed).into(); - (match layer { - Layer::Fg => anstyle::Style::new().fg_color(Some(color)), - Layer::Bg => anstyle::Style::new().bg_color(Some(color)), - Layer::Underline => anstyle::Style::new().underline_color(Some(color)), - }) | effects -} - -fn print_number( - stdout: &mut std::io::StdoutLock<'static>, - fixed: u8, - style: anstyle::Style, -) -> std::io::Result<()> { - let fg = style.get_fg_color().and_then(|c| match c { - anstyle::Color::Ansi(c) => Some(c), - anstyle::Color::Ansi256(c) => c.into_ansi(), - anstyle::Color::Rgb(_) => None, - }); - let bg = style.get_bg_color().and_then(|c| match c { - anstyle::Color::Ansi(c) => Some(c), - anstyle::Color::Ansi256(c) => c.into_ansi(), - anstyle::Color::Rgb(_) => None, - }); - - stdout - .write_colored(fg, bg, format!("{:>4}", fixed).as_bytes()) - .map(|_| ()) -} - -#[derive(Default)] -struct Args { - effects: anstyle::Effects, - layer: Layer, -} - -#[derive(Copy, Clone, Default)] -enum Layer { - #[default] - Fg, - Bg, - Underline, -} - -impl Args { - fn parse() -> Result { - use lexopt::prelude::*; - - let mut res = Args::default(); - - let mut args = lexopt::Parser::from_env(); - while let Some(arg) = args.next()? { - match arg { - Long("layer") => { - res.layer = args.value()?.parse_with(|s| match s { - "fg" => Ok(Layer::Fg), - "bg" => Ok(Layer::Bg), - "underline" => Ok(Layer::Underline), - _ => Err("expected values fg, bg, underline"), - })?; - } - Long("effect") => { - const EFFECTS: [(&str, anstyle::Effects); 12] = [ - ("bold", anstyle::Effects::BOLD), - ("dimmed", anstyle::Effects::DIMMED), - ("italic", anstyle::Effects::ITALIC), - ("underline", anstyle::Effects::UNDERLINE), - ("double_underline", anstyle::Effects::UNDERLINE), - ("curly_underline", anstyle::Effects::CURLY_UNDERLINE), - ("dotted_underline", anstyle::Effects::DOTTED_UNDERLINE), - ("dashed_underline", anstyle::Effects::DASHED_UNDERLINE), - ("blink", anstyle::Effects::BLINK), - ("invert", anstyle::Effects::INVERT), - ("hidden", anstyle::Effects::HIDDEN), - ("strikethrough", anstyle::Effects::STRIKETHROUGH), - ]; - let effect = args.value()?.parse_with(|s| { - EFFECTS - .into_iter() - .find(|(name, _)| *name == s) - .map(|(_, effect)| effect) - .ok_or_else(|| { - format!( - "expected one of {}", - EFFECTS - .into_iter() - .map(|(n, _)| n) - .collect::>() - .join(", ") - ) - }) - })?; - res.effects = res.effects.insert(effect); - } - _ => return Err(arg.unexpected()), - } - } - Ok(res) - } -} diff --git a/vendor/anstyle-wincon/examples/set-wincon.rs b/vendor/anstyle-wincon/examples/set-wincon.rs deleted file mode 100644 index 6febb0a..0000000 --- a/vendor/anstyle-wincon/examples/set-wincon.rs +++ /dev/null @@ -1,58 +0,0 @@ -#![cfg_attr(not(windows), allow(dead_code))] - -#[cfg(not(windows))] -fn main() { - panic!("unsupported"); -} - -#[cfg(windows)] -fn main() -> Result<(), lexopt::Error> { - use anstyle_wincon::WinconStream as _; - - let args = Args::parse()?; - let stdout = std::io::stdout(); - let mut stdout = stdout.lock(); - - let fg = args.fg.and_then(|c| c.into_ansi()); - let bg = args.bg.and_then(|c| c.into_ansi()); - - let _ = stdout.write_colored(fg, bg, "".as_bytes()); - - std::mem::forget(stdout); - - Ok(()) -} - -#[derive(Default)] -struct Args { - fg: Option, - bg: Option, -} - -impl Args { - fn parse() -> Result { - use lexopt::prelude::*; - - let mut res = Args::default(); - - let mut args = lexopt::Parser::from_env(); - while let Some(arg) = args.next()? { - match arg { - Long("fg") => { - res.fg = Some( - args.value()? - .parse_with(|s| s.parse::().map(anstyle::Ansi256Color))?, - ); - } - Long("bg") => { - res.fg = Some( - args.value()? - .parse_with(|s| s.parse::().map(anstyle::Ansi256Color))?, - ); - } - _ => return Err(arg.unexpected()), - } - } - Ok(res) - } -} diff --git a/vendor/anstyle-wincon/src/ansi.rs b/vendor/anstyle-wincon/src/ansi.rs deleted file mode 100644 index 6ac7193..0000000 --- a/vendor/anstyle-wincon/src/ansi.rs +++ /dev/null @@ -1,25 +0,0 @@ -//! Low-level ANSI-styling - -/// Write ANSI colored text to the stream -pub fn write_colored( - stream: &mut S, - fg: Option, - bg: Option, - data: &[u8], -) -> std::io::Result { - let non_default = fg.is_some() || bg.is_some(); - - if non_default { - if let Some(fg) = fg { - write!(stream, "{}", fg.render_fg())?; - } - if let Some(bg) = bg { - write!(stream, "{}", bg.render_bg())?; - } - } - let written = stream.write(data)?; - if non_default { - write!(stream, "{}", anstyle::Reset.render())?; - } - Ok(written) -} diff --git a/vendor/anstyle-wincon/src/lib.rs b/vendor/anstyle-wincon/src/lib.rs deleted file mode 100644 index e04fab6..0000000 --- a/vendor/anstyle-wincon/src/lib.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Styling legacy Windows terminals -//! -//! See [`WinconStream`] -//! -//! This fills a similar role as [`winapi-util`](https://crates.io/crates/winapi-util) does for -//! [`termcolor`](https://crates.io/crates/termcolor) with the differences -//! - Uses `windows-sys` rather than `winapi` -//! - Uses [`anstyle`](https://crates.io/crates/termcolor) rather than defining its own types -//! - More focused, smaller - -#![cfg_attr(docsrs, feature(doc_auto_cfg))] - -pub mod ansi; -mod stream; -#[cfg(windows)] -pub mod windows; - -pub use stream::WinconStream; diff --git a/vendor/anstyle-wincon/src/stream.rs b/vendor/anstyle-wincon/src/stream.rs deleted file mode 100644 index 9f10108..0000000 --- a/vendor/anstyle-wincon/src/stream.rs +++ /dev/null @@ -1,178 +0,0 @@ -/// Extend `std::io::Write` with wincon styling -pub trait WinconStream { - /// Write colored text to the stream - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result; -} - -impl WinconStream for Box { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - crate::ansi::write_colored(self, fg, bg, data) - } -} - -impl WinconStream for &'_ mut Box { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - (**self).write_colored(fg, bg, data) - } -} - -impl WinconStream for std::fs::File { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - crate::ansi::write_colored(self, fg, bg, data) - } -} - -impl WinconStream for &'_ mut std::fs::File { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - (**self).write_colored(fg, bg, data) - } -} - -impl WinconStream for Vec { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - crate::ansi::write_colored(self, fg, bg, data) - } -} - -impl WinconStream for &'_ mut Vec { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - (**self).write_colored(fg, bg, data) - } -} - -impl WinconStream for std::io::Stdout { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - // Ensure exclusive access - self.lock().write_colored(fg, bg, data) - } -} - -impl WinconStream for std::io::Stderr { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - // Ensure exclusive access - self.lock().write_colored(fg, bg, data) - } -} - -#[cfg(not(windows))] -mod platform { - use super::*; - - impl WinconStream for std::io::StdoutLock<'_> { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - crate::ansi::write_colored(self, fg, bg, data) - } - } - - impl WinconStream for std::io::StderrLock<'_> { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - crate::ansi::write_colored(self, fg, bg, data) - } - } -} - -#[cfg(windows)] -mod platform { - use super::*; - - impl WinconStream for std::io::StdoutLock<'_> { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - let initial = crate::windows::stdout_initial_colors(); - crate::windows::write_colored(self, fg, bg, data, initial) - } - } - - impl WinconStream for std::io::StderrLock<'_> { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - let initial = crate::windows::stderr_initial_colors(); - crate::windows::write_colored(self, fg, bg, data, initial) - } - } -} - -impl WinconStream for &'_ mut std::io::StdoutLock<'_> { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - (**self).write_colored(fg, bg, data) - } -} - -impl WinconStream for &'_ mut std::io::StderrLock<'_> { - fn write_colored( - &mut self, - fg: Option, - bg: Option, - data: &[u8], - ) -> std::io::Result { - (**self).write_colored(fg, bg, data) - } -} diff --git a/vendor/anstyle-wincon/src/windows.rs b/vendor/anstyle-wincon/src/windows.rs deleted file mode 100644 index bf1cf56..0000000 --- a/vendor/anstyle-wincon/src/windows.rs +++ /dev/null @@ -1,263 +0,0 @@ -//! Low-level wincon-styling - -use std::os::windows::io::AsHandle; -use std::os::windows::io::AsRawHandle; - -type StdioColorResult = std::io::Result<(anstyle::AnsiColor, anstyle::AnsiColor)>; -type StdioColorInnerResult = Result<(anstyle::AnsiColor, anstyle::AnsiColor), inner::IoError>; - -/// Cached [`get_colors`] call for [`std::io::stdout`] -pub fn stdout_initial_colors() -> StdioColorResult { - static INITIAL: std::sync::OnceLock = std::sync::OnceLock::new(); - INITIAL - .get_or_init(|| get_colors_(&std::io::stdout())) - .clone() - .map_err(Into::into) -} - -/// Cached [`get_colors`] call for [`std::io::stderr`] -pub fn stderr_initial_colors() -> StdioColorResult { - static INITIAL: std::sync::OnceLock = std::sync::OnceLock::new(); - INITIAL - .get_or_init(|| get_colors_(&std::io::stderr())) - .clone() - .map_err(Into::into) -} - -/// Apply colors to future writes -/// -/// **Note:** Make sure any buffers are first flushed or else these colors will apply -pub fn set_colors( - stream: &mut S, - fg: anstyle::AnsiColor, - bg: anstyle::AnsiColor, -) -> std::io::Result<()> { - set_colors_(stream, fg, bg).map_err(Into::into) -} - -fn set_colors_( - stream: &mut S, - fg: anstyle::AnsiColor, - bg: anstyle::AnsiColor, -) -> Result<(), inner::IoError> { - let handle = stream.as_handle(); - let handle = handle.as_raw_handle(); - let attributes = inner::set_colors(fg, bg); - inner::set_console_text_attributes(handle, attributes) -} - -/// Get the colors currently active on the console -pub fn get_colors(stream: &S) -> StdioColorResult { - get_colors_(stream).map_err(Into::into) -} - -fn get_colors_(stream: &S) -> StdioColorInnerResult { - let handle = stream.as_handle(); - let handle = handle.as_raw_handle(); - let info = inner::get_screen_buffer_info(handle)?; - let (fg, bg) = inner::get_colors(&info); - Ok((fg, bg)) -} - -pub(crate) fn write_colored( - stream: &mut S, - fg: Option, - bg: Option, - data: &[u8], - initial: StdioColorResult, -) -> std::io::Result { - let (initial_fg, initial_bg) = initial?; - let non_default = fg.is_some() || bg.is_some(); - - if non_default { - let fg = fg.unwrap_or(initial_fg); - let bg = bg.unwrap_or(initial_bg); - // Ensure everything is written with the last set of colors before applying the next set - stream.flush()?; - set_colors(stream, fg, bg)?; - } - let written = stream.write(data)?; - if non_default { - // Ensure everything is written with the last set of colors before applying the next set - stream.flush()?; - set_colors(stream, initial_fg, initial_bg)?; - } - Ok(written) -} - -mod inner { - use windows_sys::Win32::System::Console::CONSOLE_CHARACTER_ATTRIBUTES; - use windows_sys::Win32::System::Console::CONSOLE_SCREEN_BUFFER_INFO; - use windows_sys::Win32::System::Console::FOREGROUND_BLUE; - use windows_sys::Win32::System::Console::FOREGROUND_GREEN; - use windows_sys::Win32::System::Console::FOREGROUND_INTENSITY; - use windows_sys::Win32::System::Console::FOREGROUND_RED; - - use std::os::windows::io::RawHandle; - - const FOREGROUND_CYAN: CONSOLE_CHARACTER_ATTRIBUTES = FOREGROUND_BLUE | FOREGROUND_GREEN; - const FOREGROUND_MAGENTA: CONSOLE_CHARACTER_ATTRIBUTES = FOREGROUND_BLUE | FOREGROUND_RED; - const FOREGROUND_YELLOW: CONSOLE_CHARACTER_ATTRIBUTES = FOREGROUND_GREEN | FOREGROUND_RED; - const FOREGROUND_WHITE: CONSOLE_CHARACTER_ATTRIBUTES = - FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; - - #[derive(Copy, Clone, Debug)] - pub(crate) enum IoError { - BrokenPipe, - RawOs(i32), - } - - impl From for std::io::Error { - fn from(io: IoError) -> Self { - match io { - IoError::BrokenPipe => { - std::io::Error::new(std::io::ErrorKind::BrokenPipe, "console is detached") - } - IoError::RawOs(code) => std::io::Error::from_raw_os_error(code), - } - } - } - - impl IoError { - fn last_os_error() -> Self { - Self::RawOs(std::io::Error::last_os_error().raw_os_error().unwrap()) - } - } - - pub(crate) fn get_screen_buffer_info( - handle: RawHandle, - ) -> Result { - unsafe { - let handle = std::mem::transmute(handle); - if handle == 0 { - return Err(IoError::BrokenPipe); - } - - let mut info: CONSOLE_SCREEN_BUFFER_INFO = std::mem::zeroed(); - if windows_sys::Win32::System::Console::GetConsoleScreenBufferInfo(handle, &mut info) - != 0 - { - Ok(info) - } else { - Err(IoError::last_os_error()) - } - } - } - - pub(crate) fn set_console_text_attributes( - handle: RawHandle, - attributes: CONSOLE_CHARACTER_ATTRIBUTES, - ) -> Result<(), IoError> { - unsafe { - let handle = std::mem::transmute(handle); - if handle == 0 { - return Err(IoError::BrokenPipe); - } - - if windows_sys::Win32::System::Console::SetConsoleTextAttribute(handle, attributes) != 0 - { - Ok(()) - } else { - Err(IoError::last_os_error()) - } - } - } - - pub(crate) fn get_colors( - info: &CONSOLE_SCREEN_BUFFER_INFO, - ) -> (anstyle::AnsiColor, anstyle::AnsiColor) { - let attributes = info.wAttributes; - let bg = from_nibble(attributes >> 4); - let fg = from_nibble(attributes); - (fg, bg) - } - - pub(crate) fn set_colors( - fg: anstyle::AnsiColor, - bg: anstyle::AnsiColor, - ) -> CONSOLE_CHARACTER_ATTRIBUTES { - to_nibble(bg) << 4 | to_nibble(fg) - } - - fn from_nibble(color: CONSOLE_CHARACTER_ATTRIBUTES) -> anstyle::AnsiColor { - if color & FOREGROUND_WHITE == FOREGROUND_WHITE { - // 3 bits high - anstyle::AnsiColor::White - } else if color & FOREGROUND_CYAN == FOREGROUND_CYAN { - // 2 bits high - anstyle::AnsiColor::Cyan - } else if color & FOREGROUND_YELLOW == FOREGROUND_YELLOW { - // 2 bits high - anstyle::AnsiColor::Yellow - } else if color & FOREGROUND_MAGENTA == FOREGROUND_MAGENTA { - // 2 bits high - anstyle::AnsiColor::Magenta - } else if color & FOREGROUND_RED == FOREGROUND_RED { - // 1 bit high - anstyle::AnsiColor::Red - } else if color & FOREGROUND_GREEN == FOREGROUND_GREEN { - // 1 bit high - anstyle::AnsiColor::Green - } else if color & FOREGROUND_BLUE == FOREGROUND_BLUE { - // 1 bit high - anstyle::AnsiColor::Blue - } else { - // 0 bits high - anstyle::AnsiColor::Black - } - .bright(color & FOREGROUND_INTENSITY == FOREGROUND_INTENSITY) - } - - fn to_nibble(color: anstyle::AnsiColor) -> CONSOLE_CHARACTER_ATTRIBUTES { - let mut attributes = 0; - attributes |= match color.bright(false) { - anstyle::AnsiColor::Black => 0, - anstyle::AnsiColor::Red => FOREGROUND_RED, - anstyle::AnsiColor::Green => FOREGROUND_GREEN, - anstyle::AnsiColor::Yellow => FOREGROUND_YELLOW, - anstyle::AnsiColor::Blue => FOREGROUND_BLUE, - anstyle::AnsiColor::Magenta => FOREGROUND_MAGENTA, - anstyle::AnsiColor::Cyan => FOREGROUND_CYAN, - anstyle::AnsiColor::White => FOREGROUND_WHITE, - anstyle::AnsiColor::BrightBlack - | anstyle::AnsiColor::BrightRed - | anstyle::AnsiColor::BrightGreen - | anstyle::AnsiColor::BrightYellow - | anstyle::AnsiColor::BrightBlue - | anstyle::AnsiColor::BrightMagenta - | anstyle::AnsiColor::BrightCyan - | anstyle::AnsiColor::BrightWhite => unreachable!("brights were toggled off"), - }; - if color.is_bright() { - attributes |= FOREGROUND_INTENSITY; - } - attributes - } - - #[test] - fn to_from_nibble() { - const COLORS: [anstyle::AnsiColor; 16] = [ - anstyle::AnsiColor::Black, - anstyle::AnsiColor::Red, - anstyle::AnsiColor::Green, - anstyle::AnsiColor::Yellow, - anstyle::AnsiColor::Blue, - anstyle::AnsiColor::Magenta, - anstyle::AnsiColor::Cyan, - anstyle::AnsiColor::White, - anstyle::AnsiColor::BrightBlack, - anstyle::AnsiColor::BrightRed, - anstyle::AnsiColor::BrightGreen, - anstyle::AnsiColor::BrightYellow, - anstyle::AnsiColor::BrightBlue, - anstyle::AnsiColor::BrightMagenta, - anstyle::AnsiColor::BrightCyan, - anstyle::AnsiColor::BrightWhite, - ]; - for expected in COLORS { - let nibble = to_nibble(expected); - let actual = from_nibble(nibble); - assert_eq!(expected, actual, "Intermediate: {}", nibble); - } - } -} -- cgit v1.2.3