use crate::{
commands::{Cli, Result},
print_tip,
};
use clap::Parser;
use color_print::cprintln;
/// Undo previous operation.
///
/// The undo buffer has a size of *one* which means you can't undo two or more changes.
///
/// So undo itself can be undone by calling `jobber undo` again.
#[derive(Parser, Debug)]
pub(crate) struct Undo {}
impl Undo {
pub(crate) fn run(&self, cli: &Cli) -> Result<()> {
cli.restore_database()?;
cprintln!("Successfully restored previous database.");
print_tip!(cli);
print_tip!(
cli,
"Use <s>jobber undo</> again to restore the undone state."
);
Ok(())
}
}