pub type CommandResult = Result<()>;Expand description
Result type for Clawless commands
Commands in Clawless execute a piece of logic that might fail for various reasons. If such an error is unrecoverable during the execution of the command, it will cause the CLI to fail and exit with an error message.
To make it easier to handle errors when implementing commands, every command
handler returns a CommandResult type. This makes it possible to use the
question mark ? operator and return early when an unrecoverable error
occurs.
The CommandResult is a type alias for anyhow::Result<()>, which provides
a more ergonomic way to handle arbitrary errors. Since it isn’t possible to
recover from the error, we do not need to provide a specific error type
that a caller could handle gracefully. Similarly, commands do not need to
return a value, thus the result is always Result<()>.
Aliased Type§
pub enum CommandResult {
Ok(()),
Err(Error),
}