Move 'start' to use ShellError (#1743)

* Move 'start' to use ShellError

* Remove unnecessary changes

* Add missing macOS change

* Add default

* More fixed

* More fixed
This commit is contained in:
Jonathan Turner
2020-05-10 08:08:53 +12:00
committed by GitHub
parent ccd5d69fd1
commit 0f0847e45b
6 changed files with 115 additions and 103 deletions

View File

@ -1,6 +1,6 @@
use nu_errors::ShellError;
use nu_plugin::Plugin;
use nu_protocol::{CallInfo, Signature, SyntaxShape, Value};
use nu_protocol::{CallInfo, ReturnValue, Signature, SyntaxShape};
use crate::start::Start;
@ -14,12 +14,11 @@ impl Plugin for Start {
SyntaxShape::String,
"Specifies the application used for opening the files/directories/urls",
Some('a'),
))
)
.filter())
}
fn sink(&mut self, call_info: CallInfo, input: Vec<Value>) {
self.parse(call_info, input);
if let Err(e) = self.exec() {
println!("{}", e);
}
fn begin_filter(&mut self, call_info: CallInfo) -> Result<Vec<ReturnValue>, ShellError> {
self.parse(call_info)?;
self.exec().map(|_| vec![])
}
}