Skip to main content

handle_clap_result

Function handle_clap_result 

Source
pub fn handle_clap_result<I, T>(cmd: Command, itr: I) -> UResult<ArgMatches>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Expand description

Handles clap command parsing results with proper localization support.

This is the main entry point for processing command-line arguments with localized error messages. It parses the provided arguments and returns either the parsed matches or handles errors with localized messages.

§Arguments

  • cmd - The clap Command to parse arguments against
  • itr - An iterator of command-line arguments to parse

§Returns

  • Ok(ArgMatches) - Successfully parsed command-line arguments
  • Err - For help/version display (preserves original styling)

§Examples

use clap::Command;
use uucore::clap_localization::handle_clap_result;

let cmd = Command::new("myutil");
let args = vec!["myutil", "--help"];
let result = handle_clap_result(cmd, args);