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/examples/set-wincon.rs | 58 ---------------------------- 1 file changed, 58 deletions(-) delete mode 100644 vendor/anstyle-wincon/examples/set-wincon.rs (limited to 'vendor/anstyle-wincon/examples/set-wincon.rs') 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) - } -} -- cgit v1.2.3