Commit 02b99718 authored by Wohlgemuth, Jason's avatar Wohlgemuth, Jason
Browse files

feat: use get_parent; improve logging a bit

parent 3e56f273
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ use clap_verbosity_flag::Verbosity;
use color_eyre::eyre::Report;
use exitcode;
use nanoid::nanoid;
use pipe_lib::{get_conda_environment_name, Command, Config, EnvironmentValue, Label, ModuleLanguage, ModuleType, ModuleUri, Script};
use pipe_lib::{get_conda_environment_name, get_parent, Command, Config, EnvironmentValue, Label, ModuleLanguage, ModuleType, ModuleUri, Script};
use rayon::prelude::*;
use std::convert::TryFrom;
use std::env;
@@ -189,7 +189,7 @@ pub fn run(
            cfg.modules.iter().for_each(|module| match &module.module_type {
                | ModuleType::Binary { ref uri, .. } => {
                    let envs = EnvironmentValue::get_from_config(&cfg, Some(module.clone()));
                    let parent = PathBuf::from(uri).parent().unwrap().to_string_lossy().to_string();
                    let parent = get_parent(PathBuf::from(uri)).to_string_lossy().to_string();
                    let working_dir = URI::try_from(parent.as_str()).unwrap().clone().path().to_string();
                    let loaded = Script::from_module(module.clone(), Some(PathBuf::from(working_dir.clone())));
                    let script = loaded.expand_arguments_from(envs).with_current_dir(working_dir);
+3 −3
Original line number Diff line number Diff line
@@ -612,7 +612,7 @@ impl Label {
        " RUN ▶ ".style(style)
    }
    pub fn using() -> Styled<&'static &'static str> {
        let style = Style::new().dimmed();
        let style = Style::new().cyan();
        "USING".style(style)
    }
}
@@ -997,8 +997,8 @@ impl Script {
                | Ok(result) => {
                    if result.status.success() {
                        let output = output;
                        trace!("=> {} {:#?}", Label::output(), result);
                        trace!("=> {} {:#?}", Label::output(), output);
                        trace!("=> {} {:#?}", Label::output(), result.dimmed());
                        trace!("=> {} {:#?}", Label::output(), output.dimmed());
                        output
                    } else {
                        error!(script = self.to_string(), "=> {}", Label::fail());