diff --git a/README.md b/README.md index e34b848..bdc5719 100644 --- a/README.md +++ b/README.md @@ -267,7 +267,9 @@ Thank you ❤️ - [Jamie Quigley](https://github.com/Sciencentistguy). - [Loïc Reynier](https://github.com/loicreynier). - [Mr Hedgehog](https://github.com/ModdedGamers). +- [Tobias Bora](https://github.com/tobiasBora). - [Tristan Maat](https://github.com/TLATER). +- [Victor Engmark](https://github.com/l0b0). - [Norbert Melzer](https://github.com/NobbZ). - [Patrick Stevens](https://github.com/Smaug123). - [Connor Baker](https://github.com/ConnorBaker). diff --git a/src/alejandra_cli/src/ads/mod.rs b/src/alejandra_cli/src/ads/mod.rs index 93f91ef..3d713c9 100644 --- a/src/alejandra_cli/src/ads/mod.rs +++ b/src/alejandra_cli/src/ads/mod.rs @@ -16,28 +16,17 @@ pub(crate) fn random_ad() -> String { } fn sponsor_benefits() -> String { - #[allow(dead_code)] - enum Sponsor<'a> { - Individual { name: &'a str }, - Company { ad: &'a str }, - } - let sponsors = [ // Proportional to total past and present contributions - (0.1247, Sponsor::Individual { name: "GuangTao Zhang" }), - (0.1468, Sponsor::Individual { name: "Fabio Leimgruber" }), - (0.2495, Sponsor::Individual { name: "Raphael Megzari" }), - (0.4790, Sponsor::Individual { name: "Daniel Salazar" }), + (0.1247, "GuangTao Zhang"), + (0.1468, "Fabio Leimgruber"), + (0.2495, "Raphael Megzari"), + (0.4790, "Daniel Salazar"), ]; - match random_weighted_choice(&sponsors[..]) { - Sponsor::Company { ad } => { - include_str!("sponsor_advertisement.txt").replace("{ad}", ad) - } - Sponsor::Individual { name } => { - include_str!("sponsor_thanks.txt").replace("{name}", name) - } - } + let name = random_weighted_choice(&sponsors[..]); + + include_str!("sponsor_thanks.txt").replace("{name}", name) } fn contributor_thanks() -> String { @@ -61,7 +50,9 @@ fn contributor_thanks() -> String { (1.0, ("Rok Garbas", "garbas")), (1.0, ("Ryan Mulligan", "ryantm")), (1.0, ("Thomas Bereknyei", "tomberek")), + (1.0, ("Tobias Bora", "tobiasBora")), (1.0, ("Tristan Maat", "TLATER")), + (1.0, ("Victor Engmark", "l0b0")), (1.0, ("Vincent Ambo", "tazjin")), (1.0, ("Yorick van Pelt", "yorickvP")), ]; @@ -74,18 +65,7 @@ fn contributor_thanks() -> String { } fn please_sponsor() -> String { - let messages = [ - (0.5000, include_str!("sponsor_advertisement.txt").replace( - "{ad}", - concat!( - "Advertise your company here, reach lots of active Nix users!\n", - "More information at: https://github.com/sponsors/kamadorueda\n" - ), - )), - (0.5000, include_str!("please_sponsor.txt").to_string()), - ]; - - random_weighted_choice(&messages[..]).clone() + include_str!("please_sponsor.txt").to_string() } fn please_star() -> String { diff --git a/src/alejandra_cli/src/ads/please_sponsor.txt b/src/alejandra_cli/src/ads/please_sponsor.txt index 7133e0d..b9185ae 100644 --- a/src/alejandra_cli/src/ads/please_sponsor.txt +++ b/src/alejandra_cli/src/ads/please_sponsor.txt @@ -1,2 +1 @@ -🤟 If Alejandra is useful to you, please consider sponsoring its author! -There are cool benefits for you: https://github.com/sponsors/kamadorueda +🤟 If Alejandra is useful to you, please consider sponsoring its author: https://github.com/sponsors/kamadorueda diff --git a/src/alejandra_cli/src/ads/please_star.txt b/src/alejandra_cli/src/ads/please_star.txt index eb0f70c..31f80ad 100644 --- a/src/alejandra_cli/src/ads/please_star.txt +++ b/src/alejandra_cli/src/ads/please_star.txt @@ -1,2 +1 @@ -⭐ If Alejandra is useful to you, please add your star to the repository. -Thank you! https://github.com/kamadorueda/alejandra +⭐ If Alejandra is useful to you, please add your star to the repository: https://github.com/kamadorueda/alejandra diff --git a/src/alejandra_cli/src/ads/sponsor_advertisement.txt b/src/alejandra_cli/src/ads/sponsor_advertisement.txt deleted file mode 100644 index 0b25e69..0000000 --- a/src/alejandra_cli/src/ads/sponsor_advertisement.txt +++ /dev/null @@ -1 +0,0 @@ -👉 [Sponsored] {ad} diff --git a/src/alejandra_cli/src/cli.rs b/src/alejandra_cli/src/cli.rs index bab102c..24eac2b 100644 --- a/src/alejandra_cli/src/cli.rs +++ b/src/alejandra_cli/src/cli.rs @@ -51,7 +51,7 @@ struct CLIArgs { #[derive(Clone)] struct FormattedPath { - pub path: String, + pub path: String, pub status: alejandra::format::Status, } @@ -147,12 +147,12 @@ pub fn main() -> std::io::Result<()> { let formatted_paths = match &include[..] { &[] | &["-"] => { vec![crate::cli::format_stdin(verbosity)] - } + }, include => { let paths = crate::find::nix_files(include, &args.exclude); crate::cli::format_paths(paths, in_place, verbosity, threads) - } + }, }; let errors = formatted_paths @@ -183,9 +183,11 @@ pub fn main() -> std::io::Result<()> { let changed = formatted_paths .iter() - .filter(|formatted_path| match formatted_path.status { - alejandra::format::Status::Changed(changed) => changed, - _ => false, + .filter(|formatted_path| { + match formatted_path.status { + alejandra::format::Status::Changed(changed) => changed, + _ => false, + } }) .count();