1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
use crate::Flag; use crate::Vector; #[derive(Debug)] pub struct Context { pub raw_args: Vec<String>, pub args: Vector<String>, pub common_flag: Vector<Flag>, } impl Context { pub fn new(raw_args: Vec<String>) -> Context { Context { raw_args, args: Vector::default(), common_flag: Vector::default(), } } pub fn root() -> Option<Context> { None } pub fn args(mut self, args: Vec<String>) -> Self { self.args.init(Some(args)); self } }