fsociety 0.0.1

command line tool for do something
Documentation
use clap::{CommandFactory, Parser, Subcommand};
use clap_complete::{Shell, generate};
use fsociety::constant::BANNER;

#[derive(Parser)]
#[command(name = "fsociety", author, version, about, long_about = None, before_help= BANNER)]
struct Args {
    #[clap(subcommand)]
    command: Option<Command>,
}

#[derive(Subcommand)]
enum Command {
    /// Just say hi!
    Hi,
    /// Add two digit numbers
    Sum {
        num1: f64,
        num2: f64,
    },
    /// Generate auto complete for any shell.
    Completions {
        shell: Shell,
    },
}

fn main() {
    let args = Args::parse();
    if let Some(command) = args.command {
        match command {
            Command::Hi => println!("Hi, have a good day!"),
            Command::Sum { num1, num2 } => println!("{}", num1 + num2),
            Command::Completions { shell } => {
                generate(
                    shell,
                    &mut Args::command(),
                    "fsociety",
                    &mut std::io::stdout(),
                );
            }
        }
    } else {
        let _ = Args::command().print_help();
    }
}