nushell/crates/nu_plugin_start/src/nu/mod.rs
Elton Leander Pinto 9a94b3c656
start command in nushell (#1727)
* mvp for start command

* modified the signature of the start command

* parse filenames

* working model for macos is done

* refactored to read from pipes

* start command works well on macos; manual testing reveals need of --args flag support

* implemented start error; color printing of warning and errors

* ran clippy and fixed warnings

* fix a clippy lint that was caught in pipeline

* fix dead code clippy lint for windows

* add cfg annotation to import
2020-05-09 06:19:48 +12:00

26 lines
827 B
Rust

use nu_errors::ShellError;
use nu_plugin::Plugin;
use nu_protocol::{CallInfo, Signature, SyntaxShape, Value};
use crate::start::Start;
impl Plugin for Start {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("start")
.desc("Opens each file/directory/URL using the default application")
.rest(SyntaxShape::String, "files/urls/directories to open")
.named(
"application",
SyntaxShape::String,
"Specifies the application used for opening the files/directories/urls",
Some('a'),
))
}
fn sink(&mut self, call_info: CallInfo, input: Vec<Value>) {
self.parse(call_info, input);
if let Err(e) = self.exec() {
println!("{}", e);
}
}
}