Skip to content
Snippets Groups Projects
Unverified Commit 432a27e8 authored by Louis's avatar Louis :fire:
Browse files

Implement default CliArgs

parent e21ce2cf
No related branches found
No related tags found
No related merge requests found
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
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment