From 8e15de7e0cdeb71434e73d4cbc1fa4a9ae34b150 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 9 Aug 2020 23:24:52 +0100 Subject: [PATCH] wip create table --- src/bin/otter.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/bin/otter.rs b/src/bin/otter.rs index fc7bf5ae..76cabe81 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -96,16 +96,10 @@ struct MainOpts { struct Subcommand ( &'static str, // command &'static str, // desc - fn(&Subcommand, MainOpts, &[String]), + fn(&Subcommand, MainOpts, Vec), ); inventory::collect!(Subcommand); -inventory::submit!{Subcommand( - "create-table", "Create a new table", |_sc, mainopts, args|{ - eprintln!("CREATE-TABLE {:?} {:?}", &mainopts, &args); - } -)} - #[derive(Error,Debug)] struct ArgumentParseError(String); display_as_debug!(ArgumentParseError); @@ -213,5 +207,17 @@ fn main() { }); let Subcommand(_,_,call) = sc; - call(sc, ma.opts, &ma.subargs); + let mut subargs = ma.subargs; + subargs.insert(0, format!("{} {}", + env::args().next().unwrap(), + &ma.subcommand)); + + call(sc, ma.opts, subargs); } + +inventory::submit!{Subcommand( + "create-table", "Create a new table", |_sc, mainopts, args|{ + + eprintln!("CREATE-TABLE {:?} {:?}", &mainopts, &args); + } +)} -- 2.30.2