diff --git a/src/cli/cli.rs b/src/cli/cli.rs index 578dc8c79d2e00028b89073ce3cd6c361c8ca533..363fa59530263e2f0b6809bf267ba23afe6e74eb 100644 --- a/src/cli/cli.rs +++ b/src/cli/cli.rs @@ -1,5 +1,6 @@ pub use std::path::PathBuf; pub use std::env::current_dir; +pub use std::default::Default; pub const USAGE: &'static str = " Static file swerver and api mocker for local development. @@ -54,4 +55,22 @@ impl Args { ).to_string_lossy().into_owned()) ) } +} + +impl Default for Args { + fn default() -> Self { + Args { + flag_dir: Some(""), + flag_port: Some(8000), + flag_config: None, + flag_threads: Some(32), + flag_address: Some("localhost"), + flag_help: false, + flag_quiet: false, + flag_no_index: false, + flag_upload: false, + flag_upload_path: None, + flag_license: false, + } + } } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 856fa7d684b67eecd7323b3a90cf39d7435875e6..832dc7725849cf292ae07853e1bc77283a2d9158 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,18 +19,8 @@ fn main() { .unwrap_or_else(|e| e.exit()); let is_quiet = args.flag_quiet; - macro_rules! printq { - ($( $x:expr ),+) => { - { - if !is_quiet { - println!($($x),*); - } - } - } - } - if args.flag_help { - printq!("{}", cli::USAGE); + if !is_quiet { println!("{}", cli::USAGE); } process::exit(0); }