fix(clap): generate command data structure

We do this in the hopes to circumvent a stack overflow.
This means we will setup the parser entirely at runtime, which actually
saves a little bit of code.
This commit is contained in:
Sebastian Thiel
2015-04-29 10:56:10 +02:00
parent 9a8ae4b7d6
commit 8ac8d3b1cb
4 changed files with 51 additions and 27 deletions

View File

@@ -1,6 +1,7 @@
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
use rustc_serialize::json;
use mime::Mime;
use clap::{App, SubCommand};
use std::fs;
use std::env;
@@ -15,6 +16,22 @@ use std::default::Default;
const FIELD_SEP: char = '.';
fn make_subcommand(command_name: &str, desc: Option<&str>,
args: &Vec<(Option<&str>, Option<&str>, Option<&str>,
Option<bool>, Option<bool>)>)
-> App<'a, 'v, 'ab, 'u, 'h, 'ar> {
// arg_name: Option<&str>,
// short_name: Option<&str>,
// help: Option<&str>,
// % if flag is not None:
// .takes_value(${rust_boolean(arg_name)})
// required: Option<bool>,
// multiple: Option<bool>
SubCommand::new(command_name)
}
#[derive(Clone, Default)]
pub struct FieldCursor(Vec<String>);