1use std::str::FromStr;
2use structopt::StructOpt;
3
4#[derive(Debug, StructOpt, Clone)]
6#[structopt(
7 name = "๐ฆ Licensebat",
8 author("๐ป Roberto Huertas <roberto.huertas@outlook.com>"),
9 long_about = "๐งฐ Utility to help you check that your project's dependencies comply with your license policy.\n๐ฆ Humbly written with Rust. ๐งก\n
10 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
11 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
12 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
13 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
14 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
15"
16)]
17pub struct Cli {
18 #[structopt(short, long)]
21 pub dependency_file: String,
22 #[structopt(short, long, default_value = ".licrc")]
24 pub licrc_file: String,
25 #[structopt(short = "f", long, default_value = "json")]
27 pub output_format: OutputFormat,
28}
29
30#[derive(Debug, Clone)]
32pub enum OutputFormat {
33 Json,
35 Markdown,
37}
38
39impl FromStr for OutputFormat {
40 type Err = &'static str;
41
42 fn from_str(s: &str) -> Result<Self, Self::Err> {
43 match s {
44 "markdown" | "md" => Ok(Self::Markdown),
45 _ => Ok(Self::Json),
46 }
47 }
48}