From 7f529190241342f95c0e5190199bfe0a9d217a02 Mon Sep 17 00:00:00 2001 From: Frederik Delaere Date: Tue, 12 Mar 2019 14:44:48 +0100 Subject: [PATCH] don't filter output when var is set (ignore add_to_info_bin) --- create_dist.sh | 2 +- src/script.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/create_dist.sh b/create_dist.sh index 1c882bf..2b4cb98 100755 --- a/create_dist.sh +++ b/create_dist.sh @@ -2,7 +2,7 @@ ./build_static.sh -VERSION=`cat Cargo.toml | grep version | awk -F' = ' '{ print $2 }' | sed -e 's/^"//' -e 's/"$//'` +VERSION=`cat Cargo.toml | grep -m 1 version | awk -F' = ' '{ print $2 }' | sed -e 's/^"//' -e 's/"$//'` DIR="rsmodules_$VERSION" OS=`uname | tr '[:upper:]' '[:lower:]'` MACHINE=`uname -m` diff --git a/src/script.rs b/src/script.rs index 7f17f75..c9fd8cf 100755 --- a/src/script.rs +++ b/src/script.rs @@ -713,7 +713,8 @@ pub fn get_info(shell: &str, module: &str) -> Vec { } let mut execs: Vec = Vec::new(); - if INFO_BIN.lock().unwrap().is_empty() { + let mut filtered: bool = false; + if INFO_BIN.lock().unwrap().is_empty() || env::var("RSMODULES_DONT_FILTER_INFO").is_ok() { for line in INFO_PATH.lock().unwrap().iter() { if Path::new(line).is_dir() { // if activate, activate.csh, activate.fish and activate_this.py exist @@ -758,6 +759,7 @@ pub fn get_info(shell: &str, module: &str) -> Vec { for bin in bins { execs.push(format!("echo '{}'", bin)); got_output = true; + filtered = true; } } @@ -778,6 +780,12 @@ pub fn get_info(shell: &str, module: &str) -> Vec { output.push(exec); } + if filtered { + output.push(String::from("echo ''")); + output.push(String::from("echo 'Some binaries are omitted in this output'")); + output.push(String::from("echo 'Set the environment var RSMODULES_DONT_FILTER_INFO if you want unfiltered output'")); + } + if got_output { output.push(String::from("echo ''")); }