diff --git a/Cargo.lock b/Cargo.lock index e1fc3ee18c..da805457a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2093,6 +2093,7 @@ dependencies = [ "nu_plugin_match", "nu_plugin_post", "nu_plugin_ps", + "nu_plugin_start", "nu_plugin_str", "nu_plugin_sys", "nu_plugin_textview", diff --git a/Cargo.toml b/Cargo.toml index 8e1e767b5a..e8e78243b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ nu_plugin_inc = { version = "0.13.0", path = "./crates/nu_plugin_inc", optional= nu_plugin_match = { version = "0.13.0", path = "./crates/nu_plugin_match", optional=true } nu_plugin_post = { version = "0.13.0", path = "./crates/nu_plugin_post", optional=true } nu_plugin_ps = { version = "0.13.0", path = "./crates/nu_plugin_ps", optional=true } +nu_plugin_start = { version = "0.1.0", path = "./crates/nu_plugin_start", optional=true } nu_plugin_str = { version = "0.13.0", path = "./crates/nu_plugin_str", optional=true } nu_plugin_sys = { version = "0.13.0", path = "./crates/nu_plugin_sys", optional=true } nu_plugin_textview = { version = "0.13.0", path = "./crates/nu_plugin_textview", optional=true } @@ -62,7 +63,7 @@ nu-build = { version = "0.13.0", path = "./crates/nu-build" } test-bins = [] default = ["sys", "ps", "textview", "inc", "str"] -stable = ["default", "starship-prompt", "binaryview", "match", "tree", "average", "post", "fetch", "clipboard-cli", "trash-support"] +stable = ["default", "starship-prompt", "binaryview", "match", "tree", "average", "post", "fetch", "clipboard-cli", "trash-support", "start"] # Default textview = ["crossterm", "syntect", "url", "nu_plugin_textview"] @@ -79,6 +80,7 @@ match = ["nu_plugin_match"] post = ["nu_plugin_post"] trace = ["nu-parser/trace"] tree = ["nu_plugin_tree"] +start = ["nu_plugin_start"] clipboard-cli = ["nu-cli/clipboard-cli"] starship-prompt = ["nu-cli/starship-prompt"] @@ -168,6 +170,11 @@ name = "nu_plugin_stable_tree" path = "src/plugins/nu_plugin_stable_tree.rs" required-features = ["tree"] +[[bin]] +name = "nu_plugin_stable_start" +path = "src/plugins/nu_plugin_stable_start.rs" +required-features = ["start"] + # Main nu binary [[bin]] name = "nu" diff --git a/crates/nu_plugin_start/src/start.rs b/crates/nu_plugin_start/src/start.rs index 705702c5ad..e17fc857d0 100644 --- a/crates/nu_plugin_start/src/start.rs +++ b/crates/nu_plugin_start/src/start.rs @@ -144,6 +144,8 @@ impl Start { for cmd in &["xdg-open", "gnome-open", "kde-open", "wslview"] { if exec_cmd(cmd, &args).is_err() { continue; + } else { + return Ok(()); } } Err(StartError::new( diff --git a/src/plugins/nu_plugin_stable_start.rs b/src/plugins/nu_plugin_stable_start.rs new file mode 100644 index 0000000000..85e416a29f --- /dev/null +++ b/src/plugins/nu_plugin_stable_start.rs @@ -0,0 +1,9 @@ +use nu_plugin::serve_plugin; +use nu_plugin_start::Start; + +fn main() { + serve_plugin(&mut Start { + filenames: vec![], + application: None, + }); +}