1use crate::Result;
2use std::env::current_dir;
3use std::fs::create_dir;
4use std::process::exit;
5use yansi::Paint;
6
7pub trait SetupCommand {
8 fn run(&self) -> Result<()>;
9}
10
11pub struct SetupCommandImpl;
12
13impl SetupCommandImpl {
14 pub fn new() -> Self {
15 SetupCommandImpl
16 }
17}
18
19impl SetupCommand for SetupCommandImpl {
20 fn run(&self) -> Result<()> {
21 let setup_path = current_dir()?.join(".mdmg");
22 if setup_path.exists() {
23 println!("Already setuped");
24 exit(1);
25 }
26 create_dir(".mdmg")?;
27 println!("{}", Paint::green("Setup complete mdmg"));
28 Ok(())
29 }
30}