refactor: remove WikiCommand::no_repo_error

This commit is contained in:
Cyborus 2024-08-07 19:41:15 -04:00
parent 13b7bf5305
commit 09d995579f
No known key found for this signature in database

View file

@ -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<()> {