diff options
author | syn <isaqtm@gmail.com> | 2021-03-11 20:57:38 +0300 |
---|---|---|
committer | syn <isaqtm@gmail.com> | 2021-03-11 20:57:38 +0300 |
commit | 6ab586708cbc590f2b4f9265c3d07e491105970e (patch) | |
tree | 15fdb9bab3100e77ce034b82a422073fd6cac1e2 /src/main.rs | |
parent | 46d8f3abf07d1028e5a9aaee2ae74ba8f8e69903 (diff) | |
download | evr-6ab586708cbc590f2b4f9265c3d07e491105970e.tar.gz |
Add where subcommand
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 2ad7991..d1484a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ extern crate lazy_static; -use clap::{App, AppSettings, Arg}; +use clap::{App, AppSettings, Arg, SubCommand}; use env_logger; use log::error; use std::io::prelude::*; @@ -16,6 +16,7 @@ fn main() { .author("syn") .setting(AppSettings::ColoredHelp) .setting(AppSettings::UnifiedHelpMessage) + .subcommand(SubCommand::with_name("where")) .arg( Arg::with_name("src") .required(true) @@ -48,6 +49,17 @@ fn main() { } }; + match matches.subcommand() { + ("where", Some(_submodule)) => { + match backends::get_binary_by_filename(src_path.as_ref()) { + Ok(path) => eprintln!("{}", path.display()), + Err(e) => error!("No binary: {}", e), + } + return; + } + _ => {} + } + if src_path.exists() { if let Some(backend) = config.get_backend(&src_path) { match backend.run(&src_path) { |