use std::str::FromStr;
use structopt::StructOpt;
#[derive(Debug, StructOpt, Clone)]
#[structopt(
name = "๐ฆ Licensebat",
author("๐ป Roberto Huertas <roberto.huertas@outlook.com>"),
long_about = "๐งฐ Utility to help you check that your project's dependencies comply with your license policy.\n๐ฆ Humbly written with Rust. ๐งก\n
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
"
)]
pub struct Cli {
#[structopt(short, long)]
pub dependency_file: String,
#[structopt(short, long, default_value = ".licrc")]
pub licrc_file: String,
#[structopt(short = "f", long, default_value = "json")]
pub output_format: OutputFormat,
}
#[derive(Debug, Clone)]
pub enum OutputFormat {
Json,
Markdown,
}
impl FromStr for OutputFormat {
type Err = &'static str;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"markdown" | "md" => Ok(Self::Markdown),
_ => Ok(Self::Json),
}
}
}