cargo-script may be stabilizing soon, and I see myself using farben quite a lot when writing cargo scripts.
farben exposes a high-level interface via all the cprintln! macros and variations. But it also exposes a low-level interface via functions like try_color strip_ansi, ansi_strip!
I don't see these extras being used in the "common case", so I propose to cut down the prelude. (you can always add more stuff to the prelude even after v1.0, but you can't remove stuff from it if you release v1.0)
For example, I don't imagine ever needing to parse colors at runtime when I'm writing scripts:
match try_color("[red]Hello[/]") {
Ok(s) => print!("{s}"),
Err(e) => eprintln!("parse error: {e}"),
}
I'd just use cprint!("[red]Hello[/]")
I believe it'd make sense to reduce the prelude to only these:
New prelude
formatting:
write:
cwrite!
cwriteb!
cwriteln!
cwritebln!
stdout:
cprint!
cprintb!
cprintln!
cprintbln!
stderr:
ceprint!
ceprintb!
ceprintln!
ceprintbln!
utilities:
cargo-script may be stabilizing soon, and I see myself using
farbenquite a lot when writing cargo scripts.farbenexposes a high-level interface via all thecprintln!macros and variations. But it also exposes a low-level interface via functions liketry_colorstrip_ansi,ansi_strip!I don't see these extras being used in the "common case", so I propose to cut down the prelude. (you can always add more stuff to the prelude even after v1.0, but you can't remove stuff from it if you release v1.0)
For example, I don't imagine ever needing to parse colors at runtime when I'm writing scripts:
I'd just use
cprint!("[red]Hello[/]")I believe it'd make sense to reduce the prelude to only these:
New prelude
formatting:
cformat!cformatb!write:
cwrite!cwriteb!cwriteln!cwritebln!stdout:
cprint!cprintb!cprintln!cprintbln!stderr:
ceprint!ceprintb!ceprintln!ceprintbln!utilities:
style!prefix!