1use crate::{install::install, setup::setup};
2use clap::{Parser, Subcommand};
3
4#[derive(Debug, Parser)]
5#[clap(name = "wireman", version)]
6pub struct Args {
7 #[clap(subcommand)]
8 pub command: Option<Command>,
9
10 #[arg(short, long)]
12 pub config: Option<String>,
13
14 #[arg(short, long)]
16 pub local_protos: bool,
17}
18
19#[derive(Debug, Subcommand)]
20pub enum Command {
21 Check,
23 #[command(aliases = ["setup", "install"])]
25 Init,
26}
27
28#[must_use]
29pub fn parse() -> Args {
30 let args = Args::parse();
31 match args.command {
32 Some(Command::Check) => {
33 let _ = setup(true, &args);
34 }
35 Some(Command::Init) => {
36 install();
37 }
38 None => {}
39 }
40 args
41}