Help in parsing a few sub arguments from command line

Hi all,

I have code as

use std::env;
use std::io;
use std::io::prelude::*;
use std::process::exit;

// pub mod mesh;
pub mod axpb;

const USAGE: &str = "
Usage: rust-cuda-c bench
       rust-cuda-c <demo-name> [ options ]
       rust-cuda-c --help
Run parallel algorithms using sequential rust, parallel rust with rayon
and with GPU with RusaCuda.
Benchmarks:
  - axpb : Run axpb
";

fn usage() -> ! {
    let _ = writeln!(&mut io::stderr(), "{}", USAGE);
    exit(1);
}

fn main() {
    let args: Vec<String> = env::args().collect();

    if args.len() < 2 {
        usage();
    }

    let bench_name = &args[1];
    match &bench_name[..] {
        "axpb" => axpb::main(&args[2..]),
        _ => usage(),
    }
}

Currently I run an example as

cargo run --release axpb rayon

Which will take me to the axpb file, and I want to run a function if in cpu if the subcommand of
axpb is rayon or on the gpu if it is cuda, the code is as follows,

pub fn main(args: &[String]) {
    
}

pub fn serial_axpb(args: &[String]) {

}

This will grow in future, where I want to run it using c or c++ and etc.

What crate can I use just to parse these sub commands, currently I am using structopt, but it is overriding the main files logic.

This is in axpb file,

use structopt::StructOpt;

fn true_or_false(s: &str) -> Result<bool, &'static str> {
    match s {
        "true" => Ok(true),
        "false" => Ok(false),
        _ => Err("expected `true` or `false`"),
    }
}

/// Search for a pattern in a file and display the lines that contain it.
#[derive(StructOpt)]
struct Cli {
    /// To run code in parallel on CPU with `rayon`
    #[structopt(long, parse(try_from_str))]
    rayon: bool,

    /// To run code in parallel on GPU with `rayon`
    #[structopt(long, parse(try_from_str))]
    cuda: bool,
use structopt::StructOpt;

fn true_or_false(s: &str) -> Result<bool, &'static str> {
    match s {
        "true" => Ok(true),
        "false" => Ok(false),
        _ => Err("expected `true` or `false`"),
    }
}

/// Search for a pattern in a file and display the lines that contain it.
#[derive(StructOpt)]
struct Cli {
    /// To run code in parallel on CPU with `rayon`
    #[structopt(long, parse(try_from_str))]
    rayon: bool,

    /// To run code in parallel on GPU with `rayon`
    #[structopt(long, parse(try_from_str))]
    cuda: bool,
}


pub fn main(args: &[String]) {
    let args = Cli::from_args();
}