Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
term: add support for RAD_EDITOR
✗ CI failure moss committed 1 month ago
commit 0196be3400ae4273bce20e7d1b813a6deb3c20f6
parent 7bac17146c40b32b2ce0e27b96a555a44f3ef2ba
1 failed (1 total) View logs
1 file changed +6 -2
modified crates/radicle-term/src/editor.rs
@@ -107,7 +107,7 @@ impl Editor {
        let Some(cmd) = self::default_editor() else {
            return Err(io::Error::new(
                io::ErrorKind::NotFound,
-
                "editor not configured: the `EDITOR` environment variable is not set",
+
                "editor not configured: please set `RAD_EDITOR`, `VISUAL`, or `EDITOR` to resolve",
            ));
        };

@@ -200,7 +200,11 @@ impl Editor {

/// Get the default editor command.
fn default_editor() -> Option<OsString> {
-
    // First check the standard environment variables.
+
    if let Ok(rad_editor) = env::var("RAD_EDITOR") {
+
        if !rad_editor.is_empty() {
+
            return Some(rad_editor.into());
+
        }
+
    }
    if let Ok(visual) = env::var("VISUAL") {
        if !visual.is_empty() {
            return Some(visual.into());