use crate::{ context::Context, opt::{self, Opt}, vox, App, }; pub type Handler = fn(&App, &Context, &[String]); pub struct Command { pub name: String, pub commands: Vec, pub handler: Option, pub opts: Vec, } impl Command { pub fn new>(name: T) -> Self { Command { name: name.into(), commands: vec![], handler: None, opts: vec![], } } pub fn handler(mut self, f: Handler) -> Self { self.handler = Some(f); self } pub fn opt(mut self, opt: Opt) -> Self { self.opts.push(opt); self } } pub fn help(app: &App, _ctx: &Context, _args: &[String]) { vox::print(app.application_header()); }