updated ls to not show the .gits

This commit is contained in:
breadone 2024-07-28 17:50:07 +12:00
parent ee83fa5e84
commit 65e33a7c9f
No known key found for this signature in database

View File

@ -115,10 +115,16 @@ async fn list_repos(session: &Session) -> Vec<String> {
Err(e) => panic!("Invalid UTF-8 sequence: {}", e),
};
// split string into array``
// split string into array
let list: Vec<String> = s.split("\n").map(str::to_string).collect();
return list;
let repos: Vec<String> = 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<String>, session: &Session) {
@ -136,12 +142,12 @@ async fn clone_repo(name: &Option<String>, 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!(