Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
Add `check_radicle_cli` command
Sebastian Martinez committed 11 months ago
commit ce18d024a00c9875ce601a55a47a2c8d71344eb5
parent 01d4c0c
3 files changed +15 -0
modified crates/radicle-tauri/src/commands/startup.rs
@@ -43,6 +43,16 @@ pub(crate) fn version(app: AppHandle) -> Result<Version, Error> {
}

#[tauri::command]
+
pub(crate) fn check_radicle_cli(ctx: tauri::State<AppState>) -> Result<(), Error> {
+
    let rad = ctx.profile().home().path().join("bin/rad");
+
    if !rad.try_exists()? {
+
        return Err(Error::RadicleNotInstalled);
+
    }
+

+
    Ok(())
+
}
+

+
#[tauri::command]
pub(crate) fn startup(app: AppHandle) -> Result<Config, Error> {
    let profile = radicle::Profile::load()?;
    let repositories = profile.storage.repositories()?;
modified crates/radicle-tauri/src/lib.rs
@@ -59,6 +59,7 @@ pub fn run() {
            repo::repo_readme,
            startup::startup,
            startup::version,
+
            startup::check_radicle_cli,
            thread::create_issue_comment,
            thread::create_patch_comment,
        ])
modified crates/radicle-types/src/error.rs
@@ -11,6 +11,10 @@ pub enum Error {
    #[error(transparent)]
    ProfileError(#[from] radicle::profile::Error),

+
    /// Radicle error.
+
    #[error("radicle is not installed")]
+
    RadicleNotInstalled,
+

    /// Missing SSH Agent error.
    #[error("ssh agent not running")]
    AgentNotRunning,