mirror of
https://github.com/nushell/nushell.git
synced 2025-08-13 13:47:42 +02:00
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
This commit is contained in:
committed by
GitHub
parent
e04b89f747
commit
9a94b3c656
25
crates/nu_plugin_start/src/nu/mod.rs
Normal file
25
crates/nu_plugin_start/src/nu/mod.rs
Normal file
@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user