backhand_cli/
lib.rs

1// Compiled for every binary, as this is not a workspace
2use clap::builder::styling::*;
3#[doc(hidden)]
4pub fn styles() -> clap::builder::Styles {
5    Styles::styled()
6        .header(AnsiColor::Green.on_default() | Effects::BOLD)
7        .usage(AnsiColor::Green.on_default() | Effects::BOLD)
8        .literal(AnsiColor::Cyan.on_default() | Effects::BOLD)
9        .placeholder(AnsiColor::Cyan.on_default())
10        .error(AnsiColor::Red.on_default() | Effects::BOLD)
11        .valid(AnsiColor::Cyan.on_default() | Effects::BOLD)
12        .invalid(AnsiColor::Yellow.on_default() | Effects::BOLD)
13}
14
15#[doc(hidden)]
16pub fn after_help(rayon_env: bool) -> String {
17    let mut s = String::new();
18
19    let header = color_print::cstr!("<green, bold>Decompressors available:</>\n");
20    s.push_str(header);
21
22    #[cfg(feature = "any-gzip")]
23    s.push_str(color_print::cstr!("  <cyan, bold>gzip\n"));
24
25    #[cfg(feature = "xz")]
26    s.push_str(color_print::cstr!("  <cyan, bold>xz\n"));
27
28    #[cfg(feature = "lzo")]
29    s.push_str(color_print::cstr!("  <cyan, bold>lzo\n"));
30
31    #[cfg(feature = "zstd")]
32    s.push_str(color_print::cstr!("  <cyan, bold>zstd\n"));
33
34    s.push_str(color_print::cstr!("<green, bold>Environment Variables:\n"));
35    s.push_str(color_print::cstr!("  <cyan, bold>RUST_LOG:"));
36    s.push_str("    https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/index.html#filtering-events-with-environment-variables");
37    if rayon_env {
38        s.push('\n');
39        s.push_str(color_print::cstr!("  <cyan, bold>RAYON_NUM_THREADS:"));
40        s.push_str(r#"  https://docs.rs/rayon/latest/rayon/struct.ThreadPoolBuilder.html#method.num_threads"#);
41    }
42    s
43}