Untitled
unknown
plain_text
a year ago
864 B
1
Indexable
Never
use clap::Parser; #[derive(Parser)] pub enum Opts { Default(DefaultCommand), Use(UseCommand), Remove(RemoveCommand), } #[derive(Parser)] pub struct DefaultCommand { // Insert parameters for the 'default' command here } #[derive(Parser)] pub struct UseCommand { // Insert parameters for the 'use' command here } #[derive(Parser)] pub struct RemoveCommand { // Insert parameters for the 'remove' command here } pub fn main() { let opts: Option<Opts> = Opts::parse_from_args().ok(); match opts { Some(Opts::Default(args)) => { // handle 'default' command }, Some(Opts::Use(args)) => { // handle 'use' command }, Some(Opts::Remove(args)) => { // handle 'remove' command }, None => { // handle no command case } } }