Hristo Filaretov b8e2bdd6b1
Allow different names for ...rest (#3954)
* Allow different names for ...rest

* Resolves #3945

* This change requires an explicit name for the rest argument in `WholeStreamCommand`,
  which is why there are so many changed files.

* Remove redundant clone

* Add tests
2021-08-27 05:58:53 +12:00

29 lines
910 B
Rust

use nu_errors::ShellError;
use nu_plugin::Plugin;
use nu_protocol::{CallInfo, ReturnValue, Signature, SyntaxShape};
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(
"rest",
SyntaxShape::String,
"files/urls/directories to open",
)
.named(
"application",
SyntaxShape::String,
"Specifies the application used for opening the files/directories/urls",
Some('a'),
)
.filter())
}
fn begin_filter(&mut self, call_info: CallInfo) -> Result<Vec<ReturnValue>, ShellError> {
self.parse(call_info)?;
self.exec().map(|_| Vec::new())
}
}