Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: promote WithHint hint type to String
Adrian Duke committed 3 months ago
commit b6d59d9dc7169c9d0a684c700ca1f1cc2b5de36c
parent de55e50514d0b5b808ca7613509e142de113ea4c
7 files changed +10 -11
modified crates/radicle-cli/src/commands/id.rs
@@ -139,7 +139,7 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
                        update::error::PrivacyAllowList::PublicVisibility =>                         return Err(Error::WithHint {
                            err:
                            anyhow!("`--allow` and `--disallow` should only be used for private repositories"),
-
                            hint: "use `--visibility private` to make the repository private, or perhaps you meant to use `--delegate`/`--rescind`",
+
                            hint: "use `--visibility private` to make the repository private, or perhaps you meant to use `--delegate`/`--rescind`".to_string(),
                        }.into())
                    }
                };
modified crates/radicle-cli/src/commands/issue.rs
@@ -124,7 +124,7 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
                .get(&id)
                .map_err(|e| Error::WithHint {
                    err: e.into(),
-
                    hint: "reset the cache with `rad issue cache` and try again",
+
                    hint: "reset the cache with `rad issue cache` and try again".to_string(),
                })?
                .context("No issue with the given ID exists")?;
            term::issue::show(&issue, &id, format, args.verbose, &profile)?;
modified crates/radicle-cli/src/commands/patch/show.rs
@@ -35,7 +35,7 @@ pub fn run(
    let patches = term::cob::patches(profile, stored)?;
    let Some(patch) = patches.get(patch_id).map_err(|e| Error::WithHint {
        err: e.into(),
-
        hint: "reset the cache with `rad patch cache` and try again",
+
        hint: "reset the cache with `rad patch cache` and try again".to_string(),
    })?
    else {
        anyhow::bail!("Patch `{patch_id}` not found");
modified crates/radicle-cli/src/commands/publish.rs
@@ -27,7 +27,8 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
    if doc.is_public() {
        return Err(term::Error::WithHint {
            err: anyhow!("repository is already public"),
-
            hint: "to announce the repository to the network, run `rad sync --inventory`",
+
            hint: "to announce the repository to the network, run `rad sync --inventory`"
+
                .to_string(),
        }
        .into());
    }
@@ -39,7 +40,8 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
            err: anyhow!(
                "only repositories with a single delegate can be published with this command"
            ),
-
            hint: "see `rad id --help` to publish repositories with more than one delegate",
+
            hint: "see `rad id --help` to publish repositories with more than one delegate"
+
                .to_string(),
        }
        .into());
    }
modified crates/radicle-cli/src/terminal.rs
@@ -47,7 +47,7 @@ impl Context for DefaultContext {
            Ok(profile) => Ok(profile),
            Err(radicle::profile::Error::NotFound(path)) => Err(args::Error::WithHint {
                err: anyhow::anyhow!("Radicle profile not found in '{}'.", path.display()),
-
                hint: "To setup your radicle profile, run `rad auth`.",
+
                hint: "To setup your radicle profile, run `rad auth`.".to_string(),
            }
            .into()),
            Err(radicle::profile::Error::LoadConfig(e)) => Err(e.into()),
modified crates/radicle-cli/src/terminal/args.rs
@@ -8,10 +8,7 @@ use radicle::prelude::{Did, NodeId, RepoId};
pub(crate) enum Error {
    /// An error with a hint.
    #[error("{err}")]
-
    WithHint {
-
        err: anyhow::Error,
-
        hint: &'static str,
-
    },
+
    WithHint { err: anyhow::Error, hint: String },
}

/// Targets used in the `block` and `unblock` commands
modified crates/radicle-cli/src/terminal/cob.rs
@@ -106,7 +106,7 @@ fn with_hint(e: profile::Error) -> anyhow::Error {
        profile::Error::CobsCache(cob::cache::Error::OutOfDate) => {
            anyhow::Error::from(terminal::args::Error::WithHint {
                err: e.into(),
-
                hint: MIGRATION_HINT,
+
                hint: MIGRATION_HINT.to_string(),
            })
        }
        e => anyhow::Error::from(e),