mirror of
https://github.com/nushell/nushell.git
synced 2025-04-10 22:18:17 +02:00
* 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
26 lines
827 B
Rust
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);
|
|
}
|
|
}
|
|
}
|