Add check_radicle_cli command

We can check the Radicle home directory to see if the radicle binaries
are installed in the `RAD_HOME` folder
This commit is contained in:
Sebastian Martinez
2025-05-08 11:55:54 +02:00
parent 01d4c0c5b7
commit ce18d024a0
3 changed files with 15 additions and 0 deletions
@@ -42,6 +42,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()?;
+1
View File
@@ -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,
])
+4
View File
@@ -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,