summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
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) {