summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2023-11-17 20:50:08 +0100
committerCyborus <cyborus@cyborus.xyz>2023-11-17 20:50:08 +0100
commit51b180d4a9dc59901cdd74a2729285b506c4e013 (patch)
treeeca3666f2cfbedc8c887d69feb22ffc290c241ce /src/main.rs
parentfmt (diff)
downloadforgejo-cli-51b180d4a9dc59901cdd74a2729285b506c4e013.tar.xz
forgejo-cli-51b180d4a9dc59901cdd74a2729285b506c4e013.zip
decouple repo info from key info
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index e53b7d1..5008a92 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -39,13 +39,13 @@ async fn main() -> eyre::Result<()> {
Command::Repo(repo_subcommand) => repo_subcommand.run(&keys).await?,
Command::User { host } => {
let host = host.map(|host| Url::parse(&host)).transpose()?;
- let (url, name) = match host {
- Some(url) => (keys.get_login(&url)?.username(), url),
+ let url = match host {
+ Some(url) => url,
None => {
- let (host, _) = keys.get_current()?;
- (host.username(), host.url().clone())
+ repo::RepoInfo::get_current()?.url().clone()
}
};
+ let name = keys.get_login(&url)?.username();
eprintln!("currently signed in to {name}@{url}");
}
Command::Auth(auth_subcommand) => auth_subcommand.run(&mut keys).await?,
@@ -65,3 +65,4 @@ async fn readline(msg: &str) -> eyre::Result<String> {
})
.await?
}
+