mirror of
https://github.com/nushell/nushell.git
synced 2025-06-02 16:16:01 +02:00
* Add search terms to command * Rename Signature desc to usage To be named uniformly with extra_usage * Throw in foldl search term for reduce * Add missing usage to post * Add search terms to signature * Try to add capnp Signature serialization
28 lines
853 B
Rust
28 lines
853 B
Rust
use crate::GStat;
|
|
use nu_plugin::{EvaluatedCall, LabeledError, Plugin};
|
|
use nu_protocol::{Category, Signature, Spanned, SyntaxShape, Value};
|
|
|
|
impl Plugin for GStat {
|
|
fn signature(&self) -> Vec<Signature> {
|
|
vec![Signature::build("gstat")
|
|
.usage("Get the git status of a repo")
|
|
.optional("path", SyntaxShape::Filepath, "path to repo")
|
|
.category(Category::Custom("Prompt".to_string()))]
|
|
}
|
|
|
|
fn run(
|
|
&mut self,
|
|
name: &str,
|
|
call: &EvaluatedCall,
|
|
input: &Value,
|
|
) -> Result<Value, LabeledError> {
|
|
if name != "gstat" {
|
|
return Ok(Value::Nothing { span: call.head });
|
|
}
|
|
|
|
let repo_path: Option<Spanned<String>> = call.opt(0)?;
|
|
// eprintln!("input value: {:#?}", &input);
|
|
self.gstat(input, repo_path, &call.head)
|
|
}
|
|
}
|