Skip to content

Commit

Permalink
updated for dotfiles update command
Browse files Browse the repository at this point in the history
  • Loading branch information
KCaverly committed Dec 23, 2022
1 parent 5a45875 commit 1c2ca30
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct Project {
pub struct Dotfiles {
pub repo: String,
pub location: String,
pub command: String,
}

fn get_peaches_path() -> String {
Expand All @@ -38,14 +39,15 @@ pub fn generate_config() {
[projects]
[projects.default]
session_name = "default"
directory = "~"
directory = "/"
min_depth = 1
max_depth = 1
include_hidden = false
[dotfiles]
repo = ""
location = ""
command = ""
"#;

let peaches_path = get_peaches_path();
Expand Down
7 changes: 4 additions & 3 deletions src/dotfiles.rs
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 1c2ca30

Please sign in to comment.