//
-/*
+
use game::imports::*;
+use argparse::{self,ArgumentParser,action::{TypedAction,ParseResult}};
+use argparse::action::{Action,IArgAction};
+use std::rc::Rc;
+use std::cell::RefCell;
+
+/*
use std::cell::Cell;
pub struct CellRef<'a, T> {
type Target = Cell<T>;
fn deref(&self) -> &Cell<T> { &self.current }
}
+ */
-use structopt::StructOpt;
+struct Call;
+struct CallIArgAction<RRF>(RRF);
+impl<F> IArgAction for CallIArgAction<Rc<RefCell<F>>>
+where F : FnMut(&str) -> ParseResult {
+ fn parse_arg(&self, arg: &str) -> ParseResult {
+ self.0.borrow_mut()(arg)
+ }
+}
+impl<F: FnMut(&str) -> ParseResult> TypedAction<F> for Call {
+ fn bind<'x>(&self, f: Rc<RefCell<&'x mut F>>) -> Action<'x> {
+ Action::Single(Box::new(CallIArgAction(f.clone())))
+ }
+// fn bind<'x>(&self, t: Rc<RefCell<&'x mut F>>) -> Action<'x> {
+}
+/*\19<S,T> (&FnMut(
+}
+*/
+//use structopt::StructOpt;
-#[derive(Debug,StructOpt)]
-#[structopt(rename_all="kebab-case")]
+//#[derive(Debug,StructOpt)]
+//#[structopt(rename_all="kebab-case")]
+#[derive(Default)]
struct MainOpts {
- #[structopt(long,group="scope",overrides_with("scope"))] server_scope: bool,
- #[structopt(long,group="scope",overrides_with("scope"))] unix: bool,
- #[structopt(long,group="scope",overrides_with("scope"))] unix_user: Option<String>,
- #[structopt(subcommand)]
- cmd: Subcommand,
+ scope: Option<ManagementScope>,
}
-#[derive(Debug,StructOpt)]
+//#[derive(Debug,StructOpt)]
enum Subcommand {
CreateTable {
}
}
-*/
+
fn main() {
-/*
- let opts = MainOpts::from_args();
- println!("{:?}", &opts);
+ let mainopts : MainOpts = Default::default();
+ {
+ let ap = ArgumentParser::new();
+ /*
+ let scope = ap.refer(&mut scope);
+ scope.add_option(
+
+ Cell::from_mut(&mut mainopts.scope);
+ ap.refer(&mut &scope).
+ let opts = MainOpts::from_args();
*/
+ }
+// println!("{:?}", &opts);
}