jobber 1.1.5-alpha

Minimalistic console work time tracker
use crate::{
    commands::{Cli, Result},
    jobber::JobberDelete,
    print_tip,
};
use clap::Parser;
use color_print::cprintln;

/// Delete company information
#[derive(Parser, Debug)]
pub(crate) struct DeleteCompany {
    /// Tag's identifier
    id: String,
}

impl DeleteCompany {
    pub(crate) fn run(&self, cli: &Cli) -> Result<()> {
        let mut database = cli.open_database()?;
        database.delete_company()?;
        cli.close_database(database)?;
        cprintln!("Successfully deleted company information.",);
        print_tip!(cli);
        print_tip!(
            cli,
            "Use <s>jobber undo</> to restore the old company information."
        );
        print_tip!(cli, "Use <s>jobber create company</> to create a new one.");
        Ok(())
    }
}