summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2024-08-08 01:41:15 +0200
committerCyborus <cyborus@cyborus.xyz>2024-08-08 01:41:15 +0200
commit09d995579f60485674fd928575d903139d77a4c4 (patch)
tree03d807125b2f388aa8b31629532f50b9cb1a92fc
parentfeat: `wiki clone` (diff)
downloadforgejo-cli-09d995579f60485674fd928575d903139d77a4c4.tar.xz
forgejo-cli-09d995579f60485674fd928575d903139d77a4c4.zip
refactor: remove `WikiCommand::no_repo_error`
-rw-r--r--src/wiki.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/wiki.rs b/src/wiki.rs
index 3f31023..63d344f 100644
--- a/src/wiki.rs
+++ b/src/wiki.rs
@@ -47,7 +47,9 @@ impl WikiCommand {
let repo = RepoInfo::get_current(host_name, self.repo(), self.remote.as_deref())?;
let api = keys.get_api(repo.host_url()).await?;
- let repo = repo.name().ok_or_else(|| self.no_repo_error())?;
+ let repo = repo
+ .name()
+ .ok_or_else(|| eyre::eyre!("couldn't guess repo"))?;
match self.command {
Contents { repo: _ } => wiki_contents(&repo, &api).await?,
@@ -66,15 +68,6 @@ impl WikiCommand {
}
}
}
-
- fn no_repo_error(&self) -> eyre::Error {
- use WikiSubcommand::*;
- match &self.command {
- Contents { repo: _ } | View { .. } | Clone { .. } | Browse { .. } => {
- eyre::eyre!("couldn't guess repo")
- }
- }
- }
}
async fn wiki_contents(repo: &RepoName, api: &Forgejo) -> eyre::Result<()> {