mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-31 01:00:47 +08:00
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:
@@ -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()?;
|
||||
|
||||
@@ -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,
|
||||
])
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user