From 65e33a7c9fb52435534e41aa50db08a868c84001 Mon Sep 17 00:00:00 2001 From: breadone Date: Sun, 28 Jul 2024 17:50:07 +1200 Subject: [PATCH] updated ls to not show the .gits --- src/git.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/git.rs b/src/git.rs index 366b0b8..7dcbbba 100644 --- a/src/git.rs +++ b/src/git.rs @@ -115,10 +115,16 @@ async fn list_repos(session: &Session) -> Vec { Err(e) => panic!("Invalid UTF-8 sequence: {}", e), }; - // split string into array`` + // split string into array let list: Vec = s.split("\n").map(str::to_string).collect(); - return list; + let repos: Vec = list.iter().map(|x| { + let mut chars = x.chars(); + for _ in 0..4 { chars.next_back(); } + return chars.as_str().to_string(); + } ).collect(); + + return repos; } async fn clone_repo(name: &Option, session: &Session) { @@ -136,12 +142,12 @@ async fn clone_repo(name: &Option, session: &Session) { Err(_) => println!("error!") } } else { - unwrapped_name = name.clone().unwrap() + ".git"; + unwrapped_name = name.clone().unwrap(); } let cmd = Command::new("git") .arg("clone") - .arg("git@breadpi:/home/git/store/".to_owned() + &unwrapped_name) + .arg("git@breadpi:/home/git/store/".to_owned() + &unwrapped_name + ".git") .output().expect("Could not clone repo"); eprintln!(