use clap::Parser;
use std::env::current_dir;
use std::path::PathBuf;
use crate::scrypto::*;
use crate::utils::*;
#[derive(Parser, Debug)]
pub struct Fmt {
#[clap(long)]
path: Option<PathBuf>,
#[clap(short, long)]
check: bool,
#[clap(short, long)]
quiet: bool,
}
impl Fmt {
pub fn run(&self) -> Result<(), String> {
fmt_package(
self.path.clone().unwrap_or(current_dir().unwrap()),
self.check,
self.quiet,
)
.map(|_| ())
.map_err(|err| Error::FormatError(err).into())
}
}