use super::{Args, Command, RuntimeError, CREATE, POPULATE};
use clap::Parser;
use derive_more::{From, Into};
use std::path::PathBuf;
#[derive(Debug, From, Into)]
pub struct App {
pub args: Args,
}
impl App {
pub fn from_env() -> Self {
Args::parse().into()
}
pub fn run(self) -> Result<(), RuntimeError<PathBuf>> {
match self.args.command {
Command::Create { target } => CREATE(&target),
Command::Populate { target } => POPULATE(&target),
}
}
}