Category option for signature (#343)

* category option for signature

* category option for signature

* column description for $scope
This commit is contained in:
Fernando Herrera
2021-11-17 04:22:37 +00:00
committed by GitHub
parent 6fbe02eb21
commit b35914bd17
118 changed files with 739 additions and 335 deletions

View File

@ -3,7 +3,7 @@ use std::time::Instant;
use nu_engine::eval_block;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoPipelineData, PipelineData, Signature, SyntaxShape, Value};
use nu_protocol::{Category, IntoPipelineData, PipelineData, Signature, SyntaxShape, Value};
#[derive(Clone)]
pub struct Benchmark;
@ -18,11 +18,13 @@ impl Command for Benchmark {
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("benchmark").required(
"block",
SyntaxShape::Block(Some(vec![])),
"the block to run",
)
Signature::build("benchmark")
.required(
"block",
SyntaxShape::Block(Some(vec![])),
"the block to run",
)
.category(Category::System)
}
fn run(

View File

@ -1,7 +1,7 @@
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Value,
Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Value,
};
use sysinfo::{ProcessExt, System, SystemExt};
@ -22,6 +22,7 @@ impl Command for Ps {
Some('l'),
)
.filter()
.category(Category::System)
}
fn usage(&self) -> &str {

View File

@ -8,7 +8,7 @@ use std::sync::mpsc;
use nu_protocol::engine::{EngineState, Stack};
use nu_protocol::{ast::Call, engine::Command, ShellError, Signature, SyntaxShape, Value};
use nu_protocol::{Config, IntoInterruptiblePipelineData, PipelineData, Span, Spanned};
use nu_protocol::{Category, Config, IntoInterruptiblePipelineData, PipelineData, Span, Spanned};
use nu_engine::CallExt;
@ -26,10 +26,15 @@ impl Command for External {
"Runs external command"
}
fn is_private(&self) -> bool {
true
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("run_external")
.switch("last_expression", "last_expression", None)
.rest("rest", SyntaxShape::Any, "external command to run")
.category(Category::System)
}
fn run(

View File

@ -1,7 +1,7 @@
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Value,
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Value,
};
use sysinfo::{ComponentExt, DiskExt, NetworkExt, ProcessorExt, System, SystemExt, UserExt};
@ -17,6 +17,7 @@ impl Command for Sys {
Signature::build("sys")
.desc("View information about the current system.")
.filter()
.category(Category::System)
}
fn usage(&self) -> &str {