summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsyn <isaqtm@gmail.com>2020-01-18 19:50:27 +0300
committersyn <isaqtm@gmail.com>2020-01-18 19:50:27 +0300
commit2ce5e581f392529e53141d746b9e08209850424d (patch)
treea4c4368ea6cfa1f445b5bb34317744c839c9421c /src
parentd1c53c1f166853d17af38fe9ce1fbf120930863b (diff)
downloadevr-2ce5e581f392529e53141d746b9e08209850424d.tar.gz
Remove structopt
There are 3 options, so structopt is an unnecessary dependency
Diffstat (limited to 'src')
-rw-r--r--src/main.rs53
1 files changed, 25 insertions, 28 deletions
diff --git a/src/main.rs b/src/main.rs
index de12b5c..a77500c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,44 +1,41 @@
extern crate lazy_static;
-use clap::AppSettings;
-use structopt::StructOpt;
+use clap::{ AppSettings, App, Arg };
use env_logger;
use log::{ trace, error };
mod conf;
mod backends;
-#[derive(StructOpt, Debug)]
-#[structopt(
- name = "evr",
- version = "0.1",
- author = "by syn",
- global_settings = &[
- AppSettings::ColoredHelp,
- AppSettings::UnifiedHelpMessage
- ],
-)]
-struct EVROpts {
- /// source filename
- #[structopt(long, index = 1)]
- src: String,
-
- /// show time (wall)
- #[structopt(short, long)]
- time: bool,
-
- /// show mem usage (rss)
- #[structopt(short, long)]
- mem: bool
-}
-
fn main() {
- let opts = EVROpts::from_args();
+ let matches = App::new("evr")
+ .version("0.1")
+ .author("syn")
+ .setting(AppSettings::ColoredHelp)
+ .setting(AppSettings::UnifiedHelpMessage)
+ .arg(Arg::with_name("src")
+ .required(true)
+ .index(1)
+ .help("source file")
+ )
+ .arg(Arg::with_name("time")
+ .short("t")
+ .long("time")
+ .help("show wall time")
+ )
+ .arg(Arg::with_name("mem")
+ .short("m")
+ .long("mem")
+ .help("show mem usage (rss)")
+ )
+ .get_matches();
+
+
env_logger::builder()
.format_timestamp(None)
.init();
- let src_path: std::path::PathBuf = opts.src.into();
+ let src_path: std::path::PathBuf = matches.value_of("src").expect("src is required").into();
let config = conf::get_conf();
let result =