When implementing environment variable configuration: 1. Follow standard environment variable conventions: - Use uppercase with underscores (e.g., `NO_COLOR`, `FORCE_COLOR`)
When implementing environment variable configuration:
NO_COLOR
, FORCE_COLOR
)NO_COLOR
, FORCE_COLOR
, CLICOLOR_FORCE
)Example:
// Bad - No validation or documentation
if std::env::var_os("FORCE_COLOR").is_some() {
ColorChoice::Always
}
// Good - Validates non-empty value and documents behavior
/// Controls color output. When set to a non-empty value, forces color output
/// regardless of terminal capabilities.
/// Takes precedence over NO_COLOR and --color settings.
if let Some(force_color) = std::env::var_os("FORCE_COLOR") {
if !force_color.is_empty() {
ColorChoice::Always
}
}
Enter the URL of a public GitHub repository