Skip to main content

nifty_cli/
error.rs

1use std::fmt;
2
3/// A problem that stops a command before it can do its work, shown as `error: …`.
4#[derive(Debug)]
5pub(crate) struct CliError(String);
6
7impl CliError {
8    pub(crate) fn new(message: impl Into<String>) -> Self {
9        Self(message.into())
10    }
11}
12
13impl fmt::Display for CliError {
14    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15        f.write_str(&self.0)
16    }
17}