mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 12:09:33 +01:00
Merge pull request 'missed a bit in the key file move' (#8) from keys-file into main
This commit is contained in:
commit
7b5dcb8d65
1 changed files with 0 additions and 25 deletions
25
src/main.rs
25
src/main.rs
|
@ -256,28 +256,3 @@ async fn readline(msg: &str) -> eyre::Result<String> {
|
|||
.await?
|
||||
}
|
||||
|
||||
async fn get_remotes() -> eyre::Result<Vec<(String, Url)>> {
|
||||
let repo = git2::Repository::open(".")?;
|
||||
let remotes = repo
|
||||
.remotes()?
|
||||
.iter()
|
||||
.filter_map(|name| {
|
||||
let name = name?.to_string();
|
||||
let url = Url::parse(repo.find_remote(&name).ok()?.url()?).ok()?;
|
||||
Some((name, url))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
Ok(remotes)
|
||||
}
|
||||
|
||||
async fn get_remote(remotes: &[(String, Url)]) -> eyre::Result<Url> {
|
||||
let url = if remotes.len() == 1 {
|
||||
remotes[0].1.clone()
|
||||
} else if let Some((_, url)) = remotes.iter().find(|(name, _)| *name == "origin") {
|
||||
url.clone()
|
||||
} else {
|
||||
bail!("could not find remote");
|
||||
};
|
||||
Ok(url)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue