diff --git a/src/config.rs b/src/config.rs index b33b7fb..bbb2cca 100644 --- a/src/config.rs +++ b/src/config.rs @@ -21,6 +21,7 @@ pub struct Project { pub struct Dotfiles { pub repo: String, pub location: String, + pub command: String, } fn get_peaches_path() -> String { @@ -38,7 +39,7 @@ pub fn generate_config() { [projects] [projects.default] session_name = "default" - directory = "~" + directory = "/" min_depth = 1 max_depth = 1 include_hidden = false @@ -46,6 +47,7 @@ pub fn generate_config() { [dotfiles] repo = "" location = "" +command = "" "#; let peaches_path = get_peaches_path(); diff --git a/src/dotfiles.rs b/src/dotfiles.rs index 79fb1b7..28f3c0c 100644 --- a/src/dotfiles.rs +++ b/src/dotfiles.rs @@ -1,6 +1,6 @@ use std::process; -pub fn git_pull_dotfiles(location: &str) { +pub fn git_pull_dotfiles(location: &str, command: &str) { println!("{}", location); let mv = process::Command::new("git") @@ -10,8 +10,9 @@ pub fn git_pull_dotfiles(location: &str) { .unwrap(); if mv.success() { - let cmd = process::Command::new("zsh") - .args(vec!["install"]) + let cmds: Vec<&str> = command.split(" ").collect(); + let cmd = process::Command::new(cmds[0]) + .args(&cmds[1..]) .current_dir(location) .status() .unwrap(); diff --git a/src/main.rs b/src/main.rs index a7bc215..938d9a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,7 +75,7 @@ fn run_projects(cfg: &config::Config) { } fn run_dotfiles(cfg: &config::Config) { - dotfiles::git_pull_dotfiles(&cfg.dotfiles.location); + dotfiles::git_pull_dotfiles(&cfg.dotfiles.location, &cfg.dotfiles.command); } fn main() {