39 lines
804 B
Rust
39 lines
804 B
Rust
|
|
use clap::{arg, Parser, Subcommand};
|
||
|
|
|
||
|
|
pub(crate) fn parse_args() -> Args {
|
||
|
|
let args = Args::parse();
|
||
|
|
|
||
|
|
match &args.command {
|
||
|
|
Some(Commands::Init { init }) => {
|
||
|
|
if *init {
|
||
|
|
println!("Initializing Side Node")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
Some(Commands::Run {}) => {
|
||
|
|
println!("Running side node")
|
||
|
|
}
|
||
|
|
None => todo!(),
|
||
|
|
}
|
||
|
|
|
||
|
|
args
|
||
|
|
}
|
||
|
|
|
||
|
|
/// Simple program to greet a person
|
||
|
|
#[derive(Parser)]
|
||
|
|
#[command(version, about, long_about = None)]
|
||
|
|
pub(crate) struct Args {
|
||
|
|
#[command(subcommand)]
|
||
|
|
command: Option<Commands>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Subcommand)]
|
||
|
|
enum Commands {
|
||
|
|
/// runs the Side Node
|
||
|
|
Run {},
|
||
|
|
Init {
|
||
|
|
/// initializes a Side Node with a config file and keypair
|
||
|
|
#[arg(short, long)]
|
||
|
|
init: bool,
|
||
|
|
},
|
||
|
|
}
|