pub(crate) fn handle_result<E: Display + Debug>(r: Result<Option<CommandResult<E>>>) -> i32 {
    match r {
        // No internal error.
        Ok(r) => match r {
            // The command was not executed, but the error was handled internally.
            None => EXIT_FAILURE,
            // The command was executed, and we got a result back from it.
            Some(r) => match r {
                // The command returned success.
                Ok(_) => EXIT_SUCCESS,
                // The command returned an error to us.
                Err(e) => {
                    eprintln!(
                        "{}",
                        match cfg!(debug_assertions) {
                            false => e.to_string(),
                            true => format!("{:?}", e),
                        }
                    );
                    EXIT_FAILURE
                }
            },
        },
        // An internal error which should be surfaced to the user.
        Err(e) => {
            eprintln!(
                "Error parsing command-line flags: {}",
                match cfg!(debug_assertions) {
                    false => e.to_string(),
                    true => format!("{:?}", e),
                },
            );
            EXIT_FAILURE
        }
    }
}
/// This is a utility function, which handles the given result returned by a
/// Command implementation. The *outer* Result being an Err means that something
/// went wrong internally in the command-line argument parsing library. The
/// *inner* Result, on the other hand, is the actual Result returned by the
/// caller-provided Command implementation itself.
///
/// Overall, if an error is encountered, it is printed to standard output. In
/// either case, the appropriate exit code (EXIT_SUCCESS or EXIT_FAILURE) is
/// returned.
This is a utility function, which handles the given result returned by a
Command implementation. The *outer* Result being an Err means that something
went wrong internally in the command-line argument parsing library. The
inner* Result, on the other hand, is the actual Result returned by the
caller-provided Command implementation itself.

Overall, if an error is encountered, it is printed to standard output. In
either case, the appropriate exit code (EXIT_SUCCESS or EXIT_FAILURE) is
returned.
This is a utility function which handles the given result returned by a Command implementation . The * outer * Result being an Err means that something went wrong internally in the command - line argument parsing library . The inner * Result on the other hand is the actual Result returned by the caller - provided Command implementation itself . Overall if an error is encountered it is printed to standard output . In either case the appropriate exit code ( EXIT_SUCCESS or EXIT_FAILURE ) is returned .
pub(crate) fn handle_result<E: Display + Debug>(r: Result<Option<CommandResult<E>>>) -> i32 {
    match r {
        // No internal error.
        Ok(r) => match r {
            // The command was not executed, but the error was handled internally.
            None => EXIT_FAILURE,
            // The command was executed, and we got a result back from it.
            Some(r) => match r {
                // The command returned success.
                Ok(_) => EXIT_SUCCESS,
                // The command returned an error to us.
                Err(e) => {
                    eprintln!(
                        "{}",
                        match cfg!(debug_assertions) {
                            false => e.to_string(),
                            true => format!("{:?}", e),
                        }
                    );
                    EXIT_FAILURE
                }
            },
        },
        // An internal error which should be surfaced to the user.
        Err(e) => {
            eprintln!(
                "Error parsing command-line flags: {}",
                match cfg!(debug_assertions) {
                    false => e.to_string(),
                    true => format!("{:?}", e),
                },
            );
            EXIT_FAILURE
        }
    }
}
pub ( crate ) fn handle_result < E : Display + Debug > ( r : Result < Option < CommandResult < E > > > ) -> i32 { match r { // No internal error. Ok ( r ) => match r { // The command was not executed, but the error was handled internally. None => EXIT_FAILURE , // The command was executed, and we got a result back from it. Some ( r ) => match r { // The command returned success. Ok ( _ ) => EXIT_SUCCESS , // The command returned an error to us. Err ( e ) => { eprintln ! ( " " match cfg ( debug_assertions ) { false e to_string ( ) true format ( " " e ) } ) ; EXIT_FAILURE } } , } , // An internal error which should be surfaced to the user. Err ( e ) => { eprintln ! ( " " match cfg ( debug_assertions ) { false e to_string ( ) true format ( " " e ) } ) ; EXIT_FAILURE } } }
This is a utility function, which handles the given result returned by a
Command implementation.
This is a utility function which handles the given result returned by a Command implementation .
r
Result<Option<CommandResult<E>>>
r
Result<Option<CommandResult<E>>>