Function check_is_command

Source
pub(crate) fn check_is_command(
    command: &str,
) -> Result<bool, VersionInformationError>
Expand description

Checks if a command-line argument is a recognized command and executes it.

This function handles special command-line flags that provide information to the user (e.g., help, version) without starting the main application.

§Arguments

  • command - A string slice representing the potential command (e.g., “-h”, “–version”).

§Returns

A Result indicating the outcome:

  • Ok(true): If the argument was a recognized command and was handled successfully.
  • Ok(false): If the argument was not a recognized command.

§Errors

Returns a VersionInformationError if the -v or --version command is used, but the application fails to retrieve its own version information (e.g., cannot calculate the executable’s hash).