Skip to content

Commit

Permalink
don't filter output when var is set (ignore add_to_info_bin)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederik Delaere committed Mar 12, 2019
1 parent dc6fc41 commit 7f52919
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion create_dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 9 additions & 1 deletion src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ pub fn get_info(shell: &str, module: &str) -> Vec<String> {
}

let mut execs: Vec<String> = 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
Expand Down Expand Up @@ -758,6 +759,7 @@ pub fn get_info(shell: &str, module: &str) -> Vec<String> {
for bin in bins {
execs.push(format!("echo '{}'", bin));
got_output = true;
filtered = true;
}
}

Expand All @@ -778,6 +780,12 @@ pub fn get_info(shell: &str, module: &str) -> Vec<String> {
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 ''"));
}
Expand Down

0 comments on commit 7f52919

Please sign in to comment.