Skip to main content

localized_help_template

Function localized_help_template 

Source
pub fn localized_help_template(util_name: &str) -> StyledStr
Expand description

Creates a localized help template for clap commands.

This function returns a help template that uses the localized “Usage:” label from the translation files. This ensures consistent localization across all utilities.

Note: We avoid using clap’s {usage-heading} placeholder because it is hardcoded to “Usage:” and cannot be localized. Instead, we manually construct the usage line with the localized label.

§Parameters

  • util_name: The name of the utility (for localization setup)

§Example

use clap::Command;
use uucore::localized_help_template;

let app = Command::new("myutil")
    .help_template(localized_help_template("myutil"));