updated ls to not show the .gits
This commit is contained in:
parent
ee83fa5e84
commit
65e33a7c9f
14
src/git.rs
14
src/git.rs
@ -115,10 +115,16 @@ async fn list_repos(session: &Session) -> Vec<String> {
|
|||||||
Err(e) => panic!("Invalid UTF-8 sequence: {}", e),
|
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();
|
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) {
|
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!")
|
Err(_) => println!("error!")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unwrapped_name = name.clone().unwrap() + ".git";
|
unwrapped_name = name.clone().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmd = Command::new("git")
|
let cmd = Command::new("git")
|
||||||
.arg("clone")
|
.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");
|
.output().expect("Could not clone repo");
|
||||||
|
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user