mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-23 10:21:48 +01:00
refactor: remove WikiCommand::no_repo_error
This commit is contained in:
parent
13b7bf5305
commit
09d995579f
1 changed files with 3 additions and 10 deletions
13
src/wiki.rs
13
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<()> {
|
||||
|
|
Loading…
Reference in a new issue