From 7446ddb73f537f031acb72d8419d03e3a88c5534 Mon Sep 17 00:00:00 2001 From: Dominik Wilkowski Date: Thu, 15 Feb 2024 10:54:21 +1000 Subject: [PATCH 1/5] fixed #75 --- rust/src/args.rs | 9 +++++++++ rust/src/gradient.rs | 2 +- rust/src/render.rs | 12 ++---------- rust/tests/args_test.rs | 28 ++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/rust/src/args.rs b/rust/src/args.rs index 962342e9..39a08a70 100644 --- a/rust/src/args.rs +++ b/rust/src/args.rs @@ -161,6 +161,11 @@ pub fn parse(args: Vec) -> Result { options.debug = true; } + // we check for the line_height flag to make sure we don't override it with the console font + let line_height_options = options_lookup.get("-z").unwrap(); + let line_height_changed = my_args.contains(&line_height_options.name.to_string()) + || my_args.contains(&line_height_options.shortcut.to_string()); + d("args::parse()", 1, Dt::Head, &options, &mut std::io::stdout()); if my_args.len() < 2 { @@ -241,6 +246,10 @@ pub fn parse(args: Vec) -> Result { )); } }; + + if options.font == Fonts::FontConsole && !line_height_changed { + options.line_height = 0; + } } OptionType::Align => { i += 1; diff --git a/rust/src/gradient.rs b/rust/src/gradient.rs index 67d23153..3675f37e 100644 --- a/rust/src/gradient.rs +++ b/rust/src/gradient.rs @@ -303,7 +303,7 @@ pub fn get_transition_steps(colors: &[String], steps: usize, options: &Options) // steps left over to be distributed let rest = (steps as i8 - (colors.len() as i8 + transition_steps * (colors.len() as i8 - 1))) as usize; // the gaps array has one less items than our points (cause it's gaps between each of the points) - let mut gaps = vec![transition_steps as i8; colors.len() - 1]; + let mut gaps = vec![transition_steps; colors.len() - 1]; let len = gaps.len(); for i in 0..rest { diff --git a/rust/src/render.rs b/rust/src/render.rs index 397bb8f0..94e566fd 100644 --- a/rust/src/render.rs +++ b/rust/src/render.rs @@ -7,7 +7,7 @@ use crate::chars::{ add_letter, add_line, add_line_height, align_last_line, get_letter_length, get_letter_space, paint_letter, }; use crate::color::{bgcolor2hex, get_background_color}; -use crate::config::{Align, BgColors, Env, Fonts, Options}; +use crate::config::{Align, BgColors, Env, Options}; use crate::debug::{d, Dt}; use crate::font; use crate::gradient::add_gradient_colors; @@ -92,14 +92,6 @@ pub fn render(options: Options) -> RenderedString { }; d(&format!("render()\nletter_spacing:{:?}", letter_spacing), 1, Dt::Log, &options, &mut std::io::stdout()); - // the console font is special in that it has less line height space - let line_height = if options.font == Fonts::FontConsole && options.line_height > 0 { - options.line_height - 1 - } else { - options.line_height - }; - d(&format!("render()\nline_height:{:?}", line_height), 1, Dt::Log, &options, &mut std::io::stdout()); - let letter_space = get_letter_space(&font.letterspace, letter_spacing, &options); let letter_space_len = get_letter_length(&letter_space, font.colors, &options); let painted_letter_space = paint_letter(&letter_space, font.colors, &options); @@ -155,7 +147,7 @@ pub fn render(options: Options) -> RenderedString { d("render() aligned last line", 1, Dt::Log, &options, &mut std::io::stdout()); add_line(&mut output, font.lines, &options); d("render() added new line", 1, Dt::Log, &options, &mut std::io::stdout()); - add_line_height(&mut output, line_height, &options); + add_line_height(&mut output, options.line_height, &options); d("render() added line_height", 1, Dt::Log, &options, &mut std::io::stdout()); add_letter(&mut output, &font.buffer, &options); d("render() added buffer", 1, Dt::Log, &options, &mut std::io::stdout()); diff --git a/rust/tests/args_test.rs b/rust/tests/args_test.rs index ec837c59..794d2619 100644 --- a/rust/tests/args_test.rs +++ b/rust/tests/args_test.rs @@ -288,6 +288,7 @@ mod args { ); options.font = Fonts::FontConsole; + options.line_height = 0; assert_eq!( parse(vec![ "path/to/bin".to_string(), @@ -298,6 +299,33 @@ mod args { .unwrap(), options ); + options.line_height = 2; + assert_eq!( + parse(vec![ + "path/to/bin".to_string(), + "my text".to_string(), + "-f".to_string(), + "Console".to_string(), + "-z".to_string(), + "2".to_string(), + ]) + .unwrap(), + options + ); + options.line_height = 1; + assert_eq!( + parse(vec![ + "path/to/bin".to_string(), + "my text".to_string(), + "-f".to_string(), + "Console".to_string(), + "-z".to_string(), + "1".to_string(), + ]) + .unwrap(), + options + ); + options.font = Fonts::FontBlock; assert_eq!( parse(vec![ From cfeb3fb98623e0d341a2ae21ebd322fd137aaafc Mon Sep 17 00:00:00 2001 From: Dominik Wilkowski Date: Thu, 15 Feb 2024 10:54:31 +1000 Subject: [PATCH 2/5] clippy --- rust/src/color.rs | 2 +- rust/src/config.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/src/color.rs b/rust/src/color.rs index 7c66577a..1ebf59e2 100644 --- a/rust/src/color.rs +++ b/rust/src/color.rs @@ -203,7 +203,7 @@ pub fn rgb2hex(rgb: &Rgb, options: &Options) -> String { d(&format!("color::rgb2hex()\nrgb:{:?}", rgb), 5, Dt::Log, options, &mut std::io::stdout()); let (r, g, b) = rgb.get_value(); - let result = format!("#{:0>2x}{:0>2x}{:0>2x}", r as u8, g as u8, b as u8); + let result = format!("#{:0>2x}{:0>2x}{:0>2x}", r, g, b); d(&format!("color::rgb2hex() {:?} -> {:?}", rgb, result), 5, Dt::Log, options, &mut std::io::stdout()); result diff --git a/rust/src/config.rs b/rust/src/config.rs index 580b45e8..c6b1fa93 100644 --- a/rust/src/config.rs +++ b/rust/src/config.rs @@ -280,9 +280,9 @@ pub struct Options { pub debug_level: u16, } -impl Options { +impl Default for Options { /// The default values for each of the options so you don't have to pick each option every time - pub fn default() -> Self { + fn default() -> Self { Options { text: String::from(""), font: Fonts::FontBlock, @@ -306,7 +306,7 @@ impl Options { } /// The type of options our [`CLIOPTIONS`] can have -#[derive(Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum OptionType { /// There is only one text option which is for the text Text, @@ -329,7 +329,7 @@ pub enum OptionType { } /// The struct of a single option inside our [`CLIOPTIONS`] -#[derive(Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct CliOption<'a> { /// The key of this option so we can address it later pub key: &'a str, From 5d52de445e5fabfbfbbcb2d5d583cf3878d81544 Mon Sep 17 00:00:00 2001 From: Dominik Wilkowski Date: Thu, 15 Feb 2024 11:02:53 +1000 Subject: [PATCH 3/5] bumped deps --- rust/Cargo.lock | 325 ++++++++++++++++++++++++------------------------ rust/Cargo.toml | 6 +- 2 files changed, 165 insertions(+), 166 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index ac0bb551..f6f556d9 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "assert_cmd" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88903cb14723e4d4003335bb7f8a14f27691649105346a0f0957466c096adfe6" +checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467" dependencies = [ "anstyle", "bstr", @@ -37,30 +37,21 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bstr" -version = "1.6.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", "regex-automata", "serde", ] -[[package]] -name = "cc" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" -dependencies = [ - "libc", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -96,12 +87,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - [[package]] name = "enable-ansi-support" version = "0.2.1" @@ -113,23 +98,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] @@ -140,9 +114,9 @@ checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193" [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -157,76 +131,50 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - -[[package]] -name = "io-lifetimes" -version = "1.0.11" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix 0.38.8", - "windows-sys 0.48.0", + "libc", + "windows-sys 0.52.0", ] [[package]] name = "is_ci" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" - -[[package]] -name = "itertools" -version = "0.10.5" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -234,9 +182,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "parking_lot" @@ -250,15 +198,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -269,13 +217,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "predicates" -version = "3.0.3" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09963355b9f467184c04017ced4a2ba2d75cbcb4e7462690d388233253d4b1a9" +checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" dependencies = [ "anstyle", "difflib", - "itertools", "predicates-core", ] @@ -297,18 +244,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -345,44 +292,30 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "regex-automata" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" - -[[package]] -name = "rustix" -version = "0.37.23" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys 0.4.5", - "windows-sys 0.48.0", + "linux-raw-sys", + "windows-sys 0.52.0", ] [[package]] @@ -393,9 +326,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "scopeguard" @@ -405,18 +338,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -425,9 +358,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -436,9 +369,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "strum" @@ -448,9 +381,9 @@ checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" [[package]] name = "strum_macros" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck", "proc-macro2", @@ -461,9 +394,9 @@ dependencies = [ [[package]] name = "supports-color" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4950e7174bffabe99455511c39707310e7e9b440364a2fcb1cc21521be57b354" +checksum = "d6398cde53adc3c4557306a96ce67b302968513830a77a95b2b17305d9719a89" dependencies = [ "is-terminal", "is_ci", @@ -471,9 +404,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -482,20 +415,20 @@ dependencies = [ [[package]] name = "temp-env" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9547444bfe52cbd79515c6c8087d8ae6ca8d64d2d31a27746320f5cb81d1a15c" +checksum = "96374855068f47402c3121c6eed88d29cb1de8f3ab27090e273e420bdabcf050" dependencies = [ "parking_lot", ] [[package]] name = "terminal_size" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix 0.37.23", + "rustix", "windows-sys 0.48.0", ] @@ -507,9 +440,9 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "wait-timeout" @@ -547,22 +480,46 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] name = "windows-targets" -version = "0.48.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1eeca1c172a285ee6c2c84c341ccea837e7c01b12fbb2d0fe3c9e550ce49ec8" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ - "windows_aarch64_gnullvm 0.48.2", - "windows_aarch64_msvc 0.48.2", - "windows_i686_gnu 0.48.2", - "windows_i686_msvc 0.48.2", - "windows_x86_64_gnu 0.48.2", - "windows_x86_64_gnullvm 0.48.2", - "windows_x86_64_msvc 0.48.2", + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -573,9 +530,15 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.2" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b10d0c968ba7f6166195e13d593af609ec2e3d24f916f081690695cf5eaffb2f" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" @@ -585,9 +548,15 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571d8d4e62f26d4932099a9efe89660e8bd5087775a2ab5cdd8b747b811f1058" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[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" @@ -597,9 +566,15 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.2" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2229ad223e178db5fbbc8bd8d3835e51e566b8474bfca58d2e6150c48bb723cd" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" @@ -609,9 +584,15 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.2" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600956e2d840c194eedfc5d18f8242bc2e17c7775b6684488af3a9fff6fe3287" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" @@ -621,9 +602,15 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea99ff3f8b49fb7a8e0d305e5aec485bd068c2ba691b6e277d29eaeac945868a" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[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" @@ -633,9 +620,15 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.2" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1a05a1ece9a7a0d5a7ccf30ba2c33e3a61a30e042ffd247567d1de1d94120d" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" @@ -645,6 +638,12 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.2" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d419259aba16b663966e29e6d7c6ecfa0bb8425818bb96f6f1f3c3eb71a6e7b9" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index e83709c4..768f82e8 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -21,9 +21,9 @@ enable-ansi-support = "0.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" rand = "0.8.5" -terminal_size = "0.2.3" +terminal_size = "0.3" supports-color = "2" [dev-dependencies] -temp-env = "0.3.0" -assert_cmd = "2.0.4" +temp-env = "0.3.6" +assert_cmd = "2.0.13" From b4a4fe20114abbee661e38d097d137b9f05c9b4c Mon Sep 17 00:00:00 2001 From: Dominik Wilkowski Date: Thu, 15 Feb 2024 11:22:06 +1000 Subject: [PATCH 4/5] added end to end test for #75 --- rust/tests/end-to-end_test.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/rust/tests/end-to-end_test.rs b/rust/tests/end-to-end_test.rs index cf98d751..0081b7d1 100644 --- a/rust/tests/end-to-end_test.rs +++ b/rust/tests/end-to-end_test.rs @@ -639,6 +639,37 @@ fn get_all_tests() -> Vec { force_color: String::from("3"), no_color: false, }, + Test { + name: String::from("Gradient with new line"), + args: vec!["test|x".to_string(), "-g".to_string(), "red,green".to_string()], + fixture: concat!("\n\n", + " \x1B[38;2;255;0;0m█\x1B[39m\x1B[38;2;255;0;28m█\x1B[39m\x1B[38;2;255;0;56m█\x1B[39m\x1B[38;2;255;0;84m█\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m█\x1B[39m\x1B[38;2;255;0;170m█\x1B[39m\x1B[38;2;255;0;198m█\x1B[39m\x1B[38;2;255;0;226m╗\x1B[39m\x1B[38;2;255;0;255m \x1B[39m\x1B[38;2;226;0;255m█\x1B[39m\x1B[38;2;198;0;255m█\x1B[39m\x1B[38;2;170;0;255m█\x1B[39m\x1B[38;2;141;0;255m█\x1B[39m\x1B[38;2;113;0;255m█\x1B[39m\x1B[38;2;84;0;255m█\x1B[39m\x1B[38;2;56;0;255m█\x1B[39m\x1B[38;2;28;0;255m╗\x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;0;28;255m█\x1B[39m\x1B[38;2;0;56;255m█\x1B[39m\x1B[38;2;0;85;255m█\x1B[39m\x1B[38;2;0;113;255m█\x1B[39m\x1B[38;2;0;141;255m█\x1B[39m\x1B[38;2;0;169;255m█\x1B[39m\x1B[38;2;0;198;255m█\x1B[39m\x1B[38;2;0;226;255m╗\x1B[39m\x1B[38;2;0;255;255m \x1B[39m\x1B[38;2;0;255;226m█\x1B[39m\x1B[38;2;0;255;198m█\x1B[39m\x1B[38;2;0;255;169m█\x1B[39m\x1B[38;2;0;255;141m█\x1B[39m\x1B[38;2;0;255;113m█\x1B[39m\x1B[38;2;0;255;85m█\x1B[39m\x1B[38;2;0;255;56m█\x1B[39m\x1B[38;2;0;255;28m█\x1B[39m\x1B[38;2;0;255;0m╗\x1B[39m\n", + " \x1B[38;2;255;0;0m╚\x1B[39m\x1B[38;2;255;0;28m═\x1B[39m\x1B[38;2;255;0;56m═\x1B[39m\x1B[38;2;255;0;84m█\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m╔\x1B[39m\x1B[38;2;255;0;170m═\x1B[39m\x1B[38;2;255;0;198m═\x1B[39m\x1B[38;2;255;0;226m╝\x1B[39m\x1B[38;2;255;0;255m \x1B[39m\x1B[38;2;226;0;255m█\x1B[39m\x1B[38;2;198;0;255m█\x1B[39m\x1B[38;2;170;0;255m╔\x1B[39m\x1B[38;2;141;0;255m═\x1B[39m\x1B[38;2;113;0;255m═\x1B[39m\x1B[38;2;84;0;255m═\x1B[39m\x1B[38;2;56;0;255m═\x1B[39m\x1B[38;2;28;0;255m╝\x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;0;28;255m█\x1B[39m\x1B[38;2;0;56;255m█\x1B[39m\x1B[38;2;0;85;255m╔\x1B[39m\x1B[38;2;0;113;255m═\x1B[39m\x1B[38;2;0;141;255m═\x1B[39m\x1B[38;2;0;169;255m═\x1B[39m\x1B[38;2;0;198;255m═\x1B[39m\x1B[38;2;0;226;255m╝\x1B[39m\x1B[38;2;0;255;255m \x1B[39m\x1B[38;2;0;255;226m╚\x1B[39m\x1B[38;2;0;255;198m═\x1B[39m\x1B[38;2;0;255;169m═\x1B[39m\x1B[38;2;0;255;141m█\x1B[39m\x1B[38;2;0;255;113m█\x1B[39m\x1B[38;2;0;255;85m╔\x1B[39m\x1B[38;2;0;255;56m═\x1B[39m\x1B[38;2;0;255;28m═\x1B[39m\x1B[38;2;0;255;0m╝\x1B[39m\n", + " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;28m \x1B[39m\x1B[38;2;255;0;56m \x1B[39m\x1B[38;2;255;0;84m█\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m║\x1B[39m\x1B[38;2;255;0;170m \x1B[39m\x1B[38;2;255;0;198m \x1B[39m\x1B[38;2;255;0;226m \x1B[39m\x1B[38;2;255;0;255m \x1B[39m\x1B[38;2;226;0;255m█\x1B[39m\x1B[38;2;198;0;255m█\x1B[39m\x1B[38;2;170;0;255m█\x1B[39m\x1B[38;2;141;0;255m█\x1B[39m\x1B[38;2;113;0;255m█\x1B[39m\x1B[38;2;84;0;255m╗\x1B[39m\x1B[38;2;56;0;255m \x1B[39m\x1B[38;2;28;0;255m \x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;0;28;255m█\x1B[39m\x1B[38;2;0;56;255m█\x1B[39m\x1B[38;2;0;85;255m█\x1B[39m\x1B[38;2;0;113;255m█\x1B[39m\x1B[38;2;0;141;255m█\x1B[39m\x1B[38;2;0;169;255m█\x1B[39m\x1B[38;2;0;198;255m█\x1B[39m\x1B[38;2;0;226;255m╗\x1B[39m\x1B[38;2;0;255;255m \x1B[39m\x1B[38;2;0;255;226m \x1B[39m\x1B[38;2;0;255;198m \x1B[39m\x1B[38;2;0;255;169m \x1B[39m\x1B[38;2;0;255;141m█\x1B[39m\x1B[38;2;0;255;113m█\x1B[39m\x1B[38;2;0;255;85m║\x1B[39m\x1B[38;2;0;255;56m \x1B[39m\x1B[38;2;0;255;28m \x1B[39m\x1B[38;2;0;255;0m \x1B[39m\n", + " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;28m \x1B[39m\x1B[38;2;255;0;56m \x1B[39m\x1B[38;2;255;0;84m█\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m║\x1B[39m\x1B[38;2;255;0;170m \x1B[39m\x1B[38;2;255;0;198m \x1B[39m\x1B[38;2;255;0;226m \x1B[39m\x1B[38;2;255;0;255m \x1B[39m\x1B[38;2;226;0;255m█\x1B[39m\x1B[38;2;198;0;255m█\x1B[39m\x1B[38;2;170;0;255m╔\x1B[39m\x1B[38;2;141;0;255m═\x1B[39m\x1B[38;2;113;0;255m═\x1B[39m\x1B[38;2;84;0;255m╝\x1B[39m\x1B[38;2;56;0;255m \x1B[39m\x1B[38;2;28;0;255m \x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;0;28;255m╚\x1B[39m\x1B[38;2;0;56;255m═\x1B[39m\x1B[38;2;0;85;255m═\x1B[39m\x1B[38;2;0;113;255m═\x1B[39m\x1B[38;2;0;141;255m═\x1B[39m\x1B[38;2;0;169;255m█\x1B[39m\x1B[38;2;0;198;255m█\x1B[39m\x1B[38;2;0;226;255m║\x1B[39m\x1B[38;2;0;255;255m \x1B[39m\x1B[38;2;0;255;226m \x1B[39m\x1B[38;2;0;255;198m \x1B[39m\x1B[38;2;0;255;169m \x1B[39m\x1B[38;2;0;255;141m█\x1B[39m\x1B[38;2;0;255;113m█\x1B[39m\x1B[38;2;0;255;85m║\x1B[39m\x1B[38;2;0;255;56m \x1B[39m\x1B[38;2;0;255;28m \x1B[39m\x1B[38;2;0;255;0m \x1B[39m\n", + " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;28m \x1B[39m\x1B[38;2;255;0;56m \x1B[39m\x1B[38;2;255;0;84m█\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m║\x1B[39m\x1B[38;2;255;0;170m \x1B[39m\x1B[38;2;255;0;198m \x1B[39m\x1B[38;2;255;0;226m \x1B[39m\x1B[38;2;255;0;255m \x1B[39m\x1B[38;2;226;0;255m█\x1B[39m\x1B[38;2;198;0;255m█\x1B[39m\x1B[38;2;170;0;255m█\x1B[39m\x1B[38;2;141;0;255m█\x1B[39m\x1B[38;2;113;0;255m█\x1B[39m\x1B[38;2;84;0;255m█\x1B[39m\x1B[38;2;56;0;255m█\x1B[39m\x1B[38;2;28;0;255m╗\x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;0;28;255m█\x1B[39m\x1B[38;2;0;56;255m█\x1B[39m\x1B[38;2;0;85;255m█\x1B[39m\x1B[38;2;0;113;255m█\x1B[39m\x1B[38;2;0;141;255m█\x1B[39m\x1B[38;2;0;169;255m█\x1B[39m\x1B[38;2;0;198;255m█\x1B[39m\x1B[38;2;0;226;255m║\x1B[39m\x1B[38;2;0;255;255m \x1B[39m\x1B[38;2;0;255;226m \x1B[39m\x1B[38;2;0;255;198m \x1B[39m\x1B[38;2;0;255;169m \x1B[39m\x1B[38;2;0;255;141m█\x1B[39m\x1B[38;2;0;255;113m█\x1B[39m\x1B[38;2;0;255;85m║\x1B[39m\x1B[38;2;0;255;56m \x1B[39m\x1B[38;2;0;255;28m \x1B[39m\x1B[38;2;0;255;0m \x1B[39m\n", + " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;28m \x1B[39m\x1B[38;2;255;0;56m \x1B[39m\x1B[38;2;255;0;84m╚\x1B[39m\x1B[38;2;255;0;113m═\x1B[39m\x1B[38;2;255;0;141m╝\x1B[39m\x1B[38;2;255;0;170m \x1B[39m\x1B[38;2;255;0;198m \x1B[39m\x1B[38;2;255;0;226m \x1B[39m\x1B[38;2;255;0;255m \x1B[39m\x1B[38;2;226;0;255m╚\x1B[39m\x1B[38;2;198;0;255m═\x1B[39m\x1B[38;2;170;0;255m═\x1B[39m\x1B[38;2;141;0;255m═\x1B[39m\x1B[38;2;113;0;255m═\x1B[39m\x1B[38;2;84;0;255m═\x1B[39m\x1B[38;2;56;0;255m═\x1B[39m\x1B[38;2;28;0;255m╝\x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;0;28;255m╚\x1B[39m\x1B[38;2;0;56;255m═\x1B[39m\x1B[38;2;0;85;255m═\x1B[39m\x1B[38;2;0;113;255m═\x1B[39m\x1B[38;2;0;141;255m═\x1B[39m\x1B[38;2;0;169;255m═\x1B[39m\x1B[38;2;0;198;255m═\x1B[39m\x1B[38;2;0;226;255m╝\x1B[39m\x1B[38;2;0;255;255m \x1B[39m\x1B[38;2;0;255;226m \x1B[39m\x1B[38;2;0;255;198m \x1B[39m\x1B[38;2;0;255;169m \x1B[39m\x1B[38;2;0;255;141m╚\x1B[39m\x1B[38;2;0;255;113m═\x1B[39m\x1B[38;2;0;255;85m╝\x1B[39m\x1B[38;2;0;255;56m \x1B[39m\x1B[38;2;0;255;28m \x1B[39m\x1B[38;2;0;255;0m \x1B[39m\n", + "\n", + " \x1B[38;2;255;0;0m█\x1B[39m\x1B[38;2;255;0;28m█\x1B[39m\x1B[38;2;255;0;56m╗\x1B[39m\x1B[38;2;255;0;84m \x1B[39m\x1B[38;2;255;0;113m \x1B[39m\x1B[38;2;255;0;141m█\x1B[39m\x1B[38;2;255;0;170m█\x1B[39m\x1B[38;2;255;0;198m╗\x1B[39m\n", + " \x1B[38;2;255;0;0m╚\x1B[39m\x1B[38;2;255;0;28m█\x1B[39m\x1B[38;2;255;0;56m█\x1B[39m\x1B[38;2;255;0;84m╗\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m█\x1B[39m\x1B[38;2;255;0;170m╔\x1B[39m\x1B[38;2;255;0;198m╝\x1B[39m\n", + " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;28m╚\x1B[39m\x1B[38;2;255;0;56m█\x1B[39m\x1B[38;2;255;0;84m█\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m╔\x1B[39m\x1B[38;2;255;0;170m╝\x1B[39m\x1B[38;2;255;0;198m \x1B[39m\n", + " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;28m█\x1B[39m\x1B[38;2;255;0;56m█\x1B[39m\x1B[38;2;255;0;84m╔\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m█\x1B[39m\x1B[38;2;255;0;170m╗\x1B[39m\x1B[38;2;255;0;198m \x1B[39m\n", + " \x1B[38;2;255;0;0m█\x1B[39m\x1B[38;2;255;0;28m█\x1B[39m\x1B[38;2;255;0;56m╔\x1B[39m\x1B[38;2;255;0;84m╝\x1B[39m\x1B[38;2;255;0;113m \x1B[39m\x1B[38;2;255;0;141m█\x1B[39m\x1B[38;2;255;0;170m█\x1B[39m\x1B[38;2;255;0;198m╗\x1B[39m\n", + " \x1B[38;2;255;0;0m╚\x1B[39m\x1B[38;2;255;0;28m═\x1B[39m\x1B[38;2;255;0;56m╝\x1B[39m\x1B[38;2;255;0;84m \x1B[39m\x1B[38;2;255;0;113m \x1B[39m\x1B[38;2;255;0;141m╚\x1B[39m\x1B[38;2;255;0;170m═\x1B[39m\x1B[38;2;255;0;198m╝\x1B[39m\n", + "\n\n").to_string(), + force_color: String::from("3"), + no_color: false, + }, + Test { + name: String::from("Gradient with new line and console font"), + args: vec!["test|x".to_string(), "-g".to_string(), "red,green".to_string(), "-f".to_string(), "console".to_string()], + fixture: concat!("\n\n", + "\x1B[38;2;255;0;0mt\x1B[39m\x1B[38;2;170;0;255me\x1B[39m\x1B[38;2;0;169;255ms\x1B[39m\x1B[38;2;0;255;0mt\x1B[39m\n", + "\x1B[38;2;255;0;0mx\x1B[39m\n", + "\n\n").to_string(), + force_color: String::from("3"), + no_color: false, + }, Test { name: String::from("Gradient independent"), args: vec!["test|x".to_string(), "-g".to_string(), "red,green".to_string(), "-i".to_string()], From 3fdaa23b31b9070c4b5dc43919183c130afb7cb7 Mon Sep 17 00:00:00 2001 From: Dominik Wilkowski Date: Thu, 15 Feb 2024 11:25:51 +1000 Subject: [PATCH 5/5] bumped version --- rust/Cargo.toml | 2 +- rust/README.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 768f82e8..2b1cc1fc 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cfonts" -version = "1.1.2" +version = "1.1.3" edition = "2021" authors = ["Dominik Wilkowski "] license = "GPL-3.0-or-later" diff --git a/rust/README.md b/rust/README.md index 85dcbe65..85d4e327 100644 --- a/rust/README.md +++ b/rust/README.md @@ -151,6 +151,8 @@ We also have an [end-to-end test script](https://github.com/dominikwilkowski/cfo ## Release History +* 1.1.3 - Fixed #75, bumped dependencies and fixed some clippy warnings +* 1.1.2 - Added `LICENSE` into the published version * 1.1.1 - Updated dependencies, bumped `terminal_size` to `0.2.3` * 1.1.0 - Added `yellow` to the gradient colors * 1.0.4 - Fixed NO_COLOR not being respected in help, fixed color conversion rgb to ansi_256