1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-30 12:07:46 +00:00

feat: add two new contributors

This commit is contained in:
Kevin Amado 2022-10-23 22:18:02 -06:00
parent c85ff49c7c
commit 422b74b10d
6 changed files with 22 additions and 41 deletions

View file

@ -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).

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -1 +0,0 @@
👉 [Sponsored] {ad}

View file

@ -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();