Skip to content

Commit

Permalink
Move ratelimit message to error Section
Browse files Browse the repository at this point in the history
  • Loading branch information
Baarsgaard committed Feb 10, 2024
1 parent 04bcafb commit 63d575c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 10 additions & 2 deletions src/commands/upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use clap::Args;
use color_eyre::eyre::{Result, WrapErr};
use color_eyre::Section;
use inquire::Select;
use self_update::{
backends::github::{ReleaseList, Update},
Expand Down Expand Up @@ -33,7 +34,10 @@ impl Upgrade {
let raw_releases = releases_cfg
.build()?
.fetch()
.wrap_err("Unable to fetch list of releases")?;
.wrap_err("Unable to fetch list of releases")
.with_suggestion(|| {
"If ratelimited: export GITHUB_TOKEN='insert_token_here'"
})?;

let releases = raw_releases
.iter()
Expand Down Expand Up @@ -67,7 +71,11 @@ impl Upgrade {
cfg = cfg.auth_token(&token);
}

let _ = cfg.build()?.update()?;
let _ = cfg
.build()?
.update()
.with_suggestion(|| "If ratelimited: export GITHUB_TOKEN='insert_token_here'");

Ok(String::default())
})
.join()
Expand Down
6 changes: 1 addition & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ enum Commands {
#[cfg(debug_assertions)]
Query(Query),
/// Download and install latest version
#[command(
visible_alias = "u",
alias = "update",
after_help = "Ratelimit fix: export GITHUB_TOKEN='insert token here'"
)]
#[command(visible_alias = "u", alias = "update")]
Upgrade(Upgrade),
}

Expand Down

0 comments on commit 63d575c

Please sign in to comment.