diff --git a/src/git.rs b/src/git.rs index 13bfaf2..2712067 100644 --- a/src/git.rs +++ b/src/git.rs @@ -21,15 +21,16 @@ pub async fn handle_git(cmd: &GitCommand) { match cmd { GitCommand::Create { name } => { - let mkdir = format!("~/store/{name}"); - let cd = format!("cd ~/store/{name}"); - let init = format!("git --bare init"); - - session.command(mkdir) - .args(["-p", &mkdir]) + let init = session.command("git") + .arg("init") + .arg("--bare") + .arg("store/".to_owned() + name + ".git") .output().await.unwrap(); - session.command(cd).output().await.unwrap(); - session.command(init).output().await.unwrap(); + + eprintln!( + "{}", + String::from_utf8(init.stdout).expect("Failed to init git repo.") + ); } _ => {