now exporting path variable at the start of the application

This commit is contained in:
2023-03-06 21:46:12 +01:00
parent 571f93ed62
commit b9f4f86758
3 changed files with 20 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ pub mod builder;
pub mod fs_util;
use std::collections::HashMap;
use std::env;
use commands::traits::Command;
use commands::CommandRegistry;
@@ -19,6 +20,7 @@ impl App {
}
pub fn start(self, args: Vec<String>) {
Self::preapare_env_path();
let command_args = &args[1..];
let mut path = String::from("");
let mut argument_map = HashMap::new();
@@ -45,6 +47,10 @@ impl App {
self.execute_path(&path, &argument_map);
}
fn preapare_env_path() {
env::set_var("PATH", fs_util::docki_path_env());
}
fn execute_path(self, path: &String, args: &HashMap<String, String>) {
let command = self.command_regisrty.command_by(path);