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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
118 changed files with 739 additions and 335 deletions

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::{ use nu_protocol::{
ast::{Call, CellPath}, ast::{Call, CellPath},
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,11 +14,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("into binary").rest( Signature::build("into binary")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"column paths to convert to binary (for table input)", SyntaxShape::CellPath,
) "column paths to convert to binary (for table input)",
)
.category(Category::Conversions)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::get_full_help;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
IntoPipelineData, PipelineData, Signature, Value, Category, IntoPipelineData, PipelineData, Signature, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,7 +14,7 @@ impl Command for Into {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("into") Signature::build("into").category(Category::Conversions)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::{ use nu_protocol::{
ast::{Call, CellPath}, ast::{Call, CellPath},
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,11 +14,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("into filesize").rest( Signature::build("into filesize")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"column paths to convert to filesize (for table input)", SyntaxShape::CellPath,
) "column paths to convert to filesize (for table input)",
)
.category(Category::Conversions)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::{ use nu_protocol::{
ast::{Call, CellPath}, ast::{Call, CellPath},
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,11 +14,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("into int").rest( Signature::build("into int")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"column paths to convert to int (for table input)", SyntaxShape::CellPath,
) "column paths to convert to int (for table input)",
)
.category(Category::Conversions)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::{ use nu_protocol::{
ast::{Call, CellPath}, ast::{Call, CellPath},
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
Config, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, Category, Config, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
}; };
// TODO num_format::SystemLocale once platform-specific dependencies are stable (see Cargo.toml) // TODO num_format::SystemLocale once platform-specific dependencies are stable (see Cargo.toml)
@ -29,6 +29,7 @@ impl Command for SubCommand {
"decimal digits to which to round", "decimal digits to which to round",
Some('d'), Some('d'),
) )
.category(Category::Conversions)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Alias; pub struct Alias;
@ -22,6 +22,7 @@ impl Command for Alias {
SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::Expression)), SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::Expression)),
"equals sign followed by value", "equals sign followed by value",
) )
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Def; pub struct Def;
@ -23,6 +23,7 @@ impl Command for Def {
SyntaxShape::Block(Some(vec![])), SyntaxShape::Block(Some(vec![])),
"body of the definition", "body of the definition",
) )
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,7 +1,7 @@
use nu_engine::{eval_block, CallExt}; use nu_engine::{eval_block, CallExt};
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape, Value}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct Do; pub struct Do;
@ -24,6 +24,7 @@ impl Command for Do {
"the block to run", "the block to run",
) )
.rest("rest", SyntaxShape::Any, "the parameter(s) for the block") .rest("rest", SyntaxShape::Any, "the parameter(s) for the block")
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,7 +1,9 @@
use nu_engine::CallExt; use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, SyntaxShape, Value, ValueStream}; use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Value, ValueStream,
};
#[derive(Clone)] #[derive(Clone)]
pub struct Echo; pub struct Echo;
@ -16,7 +18,9 @@ impl Command for Echo {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("echo").rest("rest", SyntaxShape::Any, "the values to echo") Signature::build("echo")
.rest("rest", SyntaxShape::Any, "the values to echo")
.category(Category::Core)
} }
fn run( fn run(

View File

@ -2,7 +2,7 @@ use nu_engine::get_full_help;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
IntoPipelineData, PipelineData, Signature, Value, Category, IntoPipelineData, PipelineData, Signature, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,7 +14,7 @@ impl Command for ExportCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("export") Signature::build("export").category(Category::Core)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct ExportDef; pub struct ExportDef;
@ -23,6 +23,7 @@ impl Command for ExportDef {
SyntaxShape::Block(Some(vec![])), SyntaxShape::Block(Some(vec![])),
"body of the definition", "body of the definition",
) )
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct ExportEnv; pub struct ExportEnv;
@ -26,6 +26,7 @@ impl Command for ExportEnv {
SyntaxShape::Block(Some(vec![])), SyntaxShape::Block(Some(vec![])),
"body of the environment variable definition", "body of the environment variable definition",
) )
.category(Category::Core)
} }
fn run( fn run(

View File

@ -2,7 +2,8 @@ use nu_engine::{eval_block, eval_expression};
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, PipelineData, Signature, Span, SyntaxShape, Value, Category, Example, IntoInterruptiblePipelineData, PipelineData, Signature, Span, SyntaxShape,
Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -35,6 +36,7 @@ impl Command for For {
"the block to run", "the block to run",
) )
.creates_scope() .creates_scope()
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,8 +1,8 @@
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
span, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, span, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData,
Signature, Spanned, SyntaxShape, Value, ShellError, Signature, Spanned, SyntaxShape, Value,
}; };
use nu_engine::{get_full_help, CallExt}; use nu_engine::{get_full_help, CallExt};
@ -28,6 +28,7 @@ impl Command for Help {
"string to find in command usage", "string to find in command usage",
Some('f'), Some('f'),
) )
.category(Category::Core)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
@ -107,6 +108,12 @@ fn help(
span: head, span: head,
}); });
cols.push("category".into());
vals.push(Value::String {
val: cmd.0.category.to_string(),
span: head,
});
cols.push("usage".into()); cols.push("usage".into());
vals.push(Value::String { val: c, span: head }); vals.push(Value::String { val: c, span: head });
@ -144,6 +151,12 @@ fn help(
span: head, span: head,
}); });
cols.push("category".into());
vals.push(Value::String {
val: cmd.0.category.to_string(),
span: head,
});
cols.push("usage".into()); cols.push("usage".into());
vals.push(Value::String { val: c, span: head }); vals.push(Value::String { val: c, span: head });

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Hide; pub struct Hide;
@ -10,12 +10,14 @@ impl Command for Hide {
"hide" "hide"
} }
fn usage(&self) -> &str { fn signature(&self) -> nu_protocol::Signature {
"Hide definitions in the current scope" Signature::build("hide")
.required("pattern", SyntaxShape::String, "import pattern")
.category(Category::Core)
} }
fn signature(&self) -> nu_protocol::Signature { fn usage(&self) -> &str {
Signature::build("hide").required("pattern", SyntaxShape::String, "import pattern") "Hide definitions in the current scope"
} }
fn run( fn run(

View File

@ -1,7 +1,9 @@
use nu_engine::{eval_block, eval_expression}; use nu_engine::{eval_block, eval_expression};
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Value}; use nu_protocol::{
Category, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct If; pub struct If;
@ -24,6 +26,7 @@ impl Command for If {
SyntaxShape::Keyword(b"else".to_vec(), Box::new(SyntaxShape::Expression)), SyntaxShape::Keyword(b"else".to_vec(), Box::new(SyntaxShape::Expression)),
"optional else followed by else block", "optional else followed by else block",
) )
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,7 +1,7 @@
use nu_engine::eval_expression; use nu_engine::eval_expression;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Let; pub struct Let;
@ -23,6 +23,7 @@ impl Command for Let {
SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::Expression)), SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::Expression)),
"equals sign followed by value", "equals sign followed by value",
) )
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Module; pub struct Module;
@ -22,6 +22,7 @@ impl Command for Module {
SyntaxShape::Block(Some(vec![])), SyntaxShape::Block(Some(vec![])),
"body of the module", "body of the module",
) )
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Register; pub struct Register;
@ -15,11 +15,13 @@ impl Command for Register {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("register").required( Signature::build("register")
"plugin", .required(
SyntaxShape::Filepath, "plugin",
"location of bin for plugin", SyntaxShape::Filepath,
) "location of bin for plugin",
)
.category(Category::Core)
} }
fn run( fn run(

View File

@ -1,7 +1,7 @@
use nu_engine::{eval_block, CallExt}; use nu_engine::{eval_block, CallExt};
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape};
/// Source a file for environment variables. /// Source a file for environment variables.
#[derive(Clone)] #[derive(Clone)]
@ -13,11 +13,13 @@ impl Command for Source {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("source").required( Signature::build("source")
"filename", .required(
SyntaxShape::Filepath, "filename",
"the filepath to the script file to source", SyntaxShape::Filepath,
) "the filepath to the script file to source",
)
.category(Category::Core)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use nu_engine::eval_block; use nu_engine::eval_block;
use nu_protocol::ast::{Call, Expr, Expression, ImportPatternMember}; use nu_protocol::ast::{Call, Expr, Expression, ImportPatternMember};
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature, Span, SyntaxShape}; use nu_protocol::{Category, PipelineData, ShellError, Signature, Span, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Use; pub struct Use;
@ -16,7 +16,9 @@ impl Command for Use {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("use").rest("pattern", SyntaxShape::String, "import pattern parts") Signature::build("use")
.rest("pattern", SyntaxShape::String, "import pattern parts")
.category(Category::Core)
} }
fn run( fn run(

View File

@ -2,7 +2,7 @@ use nu_engine::get_full_help;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
IntoPipelineData, PipelineData, ShellError, Signature, Value, Category, IntoPipelineData, PipelineData, ShellError, Signature, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,7 +14,7 @@ impl Command for Date {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("date") Signature::build("date").category(Category::Date)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -3,7 +3,7 @@ use nu_engine::CallExt;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
Example, PipelineData, Signature, Span, Spanned, SyntaxShape, Value, Category, Example, PipelineData, Signature, Span, Spanned, SyntaxShape, Value,
}; };
use super::utils::{parse_date_from_string, unsupported_input_error}; use super::utils::{parse_date_from_string, unsupported_input_error};
@ -17,11 +17,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("date format").required( Signature::build("date format")
"format string", .required(
SyntaxShape::String, "format string",
"the desired date format", SyntaxShape::String,
) "the desired date format",
)
.category(Category::Date)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -3,7 +3,7 @@ use chrono::{DateTime, FixedOffset, Local};
use chrono_humanize::HumanTime; use chrono_humanize::HumanTime;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("date humanize") Signature::build("date humanize").category(Category::Date)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use chrono_tz::TZ_VARIANTS; use chrono_tz::TZ_VARIANTS;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoInterruptiblePipelineData, PipelineData, Signature, Value}; use nu_protocol::{Category, IntoInterruptiblePipelineData, PipelineData, Signature, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -12,7 +12,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("date list-timezone") Signature::build("date list-timezone").category(Category::Date)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use chrono::Local; use chrono::Local;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoPipelineData, PipelineData, Signature, Value}; use nu_protocol::{Category, IntoPipelineData, PipelineData, Signature, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("date now") Signature::build("date now").category(Category::Date)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::date::utils::{parse_date_from_string, unsupported_input_error};
use chrono::{DateTime, Datelike, FixedOffset, Local, Timelike}; use chrono::{DateTime, Datelike, FixedOffset, Local, Timelike};
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("date to-table") Signature::build("date to-table").category(Category::Date)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -5,7 +5,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
}; };
use chrono::{FixedOffset, TimeZone}; use chrono::{FixedOffset, TimeZone};
@ -19,11 +19,9 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("date to-timezone").required( Signature::build("date to-timezone")
"time zone", .required("time zone", SyntaxShape::String, "time zone description")
SyntaxShape::String, .category(Category::Date)
"time zone description",
)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use nu_engine::eval_expression; use nu_engine::eval_expression;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct LetEnv; pub struct LetEnv;
@ -23,6 +23,7 @@ impl Command for LetEnv {
SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::String)), SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::String)),
"equals sign followed by value", "equals sign followed by value",
) )
.category(Category::Env)
} }
fn run( fn run(

View File

@ -7,7 +7,7 @@ use nu_engine::{eval_block, CallExt};
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
Example, PipelineData, ShellError, Signature, SyntaxShape, Value, Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -30,6 +30,7 @@ impl Command for WithEnv {
SyntaxShape::Block(Some(vec![SyntaxShape::Any])), SyntaxShape::Block(Some(vec![SyntaxShape::Any])),
"the block to run once the variable is set", "the block to run once the variable is set",
) )
.category(Category::Env)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoPipelineData, PipelineData, Signature, Value}; use nu_protocol::{Category, IntoPipelineData, PipelineData, Signature, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct Git; pub struct Git;
@ -15,7 +15,7 @@ impl Command for Git {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("git") Signature::build("git").category(Category::Experimental)
} }
fn run( fn run(

View File

@ -1,7 +1,7 @@
use nu_engine::eval_expression; use nu_engine::eval_expression;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; 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)] #[derive(Clone)]
pub struct GitCheckout; pub struct GitCheckout;
@ -16,11 +16,13 @@ impl Command for GitCheckout {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("git checkout").required( Signature::build("git checkout")
"branch", .required(
SyntaxShape::Custom(Box::new(SyntaxShape::String), "list-git-branches".into()), "branch",
"the branch to checkout", SyntaxShape::Custom(Box::new(SyntaxShape::String), "list-git-branches".into()),
) "the branch to checkout",
)
.category(Category::Experimental)
} }
fn run( fn run(

View File

@ -7,6 +7,7 @@ use nu_protocol::ast::Call;
use nu_protocol::engine::Command; use nu_protocol::engine::Command;
use nu_protocol::engine::EngineState; use nu_protocol::engine::EngineState;
use nu_protocol::engine::Stack; use nu_protocol::engine::Stack;
use nu_protocol::Category;
use nu_protocol::IntoInterruptiblePipelineData; use nu_protocol::IntoInterruptiblePipelineData;
use nu_protocol::PipelineData; use nu_protocol::PipelineData;
use nu_protocol::{Signature, Value}; use nu_protocol::{Signature, Value};
@ -25,7 +26,7 @@ impl Command for ListGitBranches {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("list-git-branches") Signature::build("list-git-branches").category(Category::Experimental)
} }
fn run( fn run(

View File

@ -1,7 +1,7 @@
use nu_engine::CallExt; use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Cd; pub struct Cd;
@ -16,7 +16,9 @@ impl Command for Cd {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("cd").optional("path", SyntaxShape::Filepath, "the path to change to") Signature::build("cd")
.optional("path", SyntaxShape::Filepath, "the path to change to")
.category(Category::FileSystem)
} }
fn run( fn run(

View File

@ -6,7 +6,7 @@ use nu_engine::CallExt;
use nu_path::canonicalize_with; use nu_path::canonicalize_with;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape};
use crate::filesystem::util::FileStructure; use crate::filesystem::util::FileStructure;
@ -34,6 +34,7 @@ impl Command for Cp {
) )
.switch("force", "suppress error when no file", Some('f')) .switch("force", "suppress error when no file", Some('f'))
.switch("interactive", "ask user to confirm action", Some('i')) .switch("interactive", "ask user to confirm action", Some('i'))
.category(Category::FileSystem)
} }
fn run( fn run(

View File

@ -3,7 +3,9 @@ use lscolors::{LsColors, Style};
use nu_engine::eval_expression; use nu_engine::eval_expression;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoInterruptiblePipelineData, PipelineData, Signature, SyntaxShape, Value}; use nu_protocol::{
Category, IntoInterruptiblePipelineData, PipelineData, Signature, SyntaxShape, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct Ls; pub struct Ls;
@ -19,11 +21,13 @@ impl Command for Ls {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("ls").optional( Signature::build("ls")
"pattern", .optional(
SyntaxShape::GlobPattern, "pattern",
"the glob pattern to use", SyntaxShape::GlobPattern,
) "the glob pattern to use",
)
.category(Category::FileSystem)
} }
fn run( fn run(

View File

@ -5,7 +5,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, SyntaxShape, Value, Category, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, SyntaxShape,
Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -24,6 +25,7 @@ impl Command for Mkdir {
"the name(s) of the path(s) to create", "the name(s) of the path(s) to create",
) )
.switch("show-created-paths", "show the path(s) created.", Some('s')) .switch("show-created-paths", "show the path(s) created.", Some('s'))
.category(Category::FileSystem)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -5,7 +5,7 @@ use super::util::get_interactive_confirmation;
use nu_engine::CallExt; use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Mv; pub struct Mv;
@ -34,6 +34,7 @@ impl Command for Mv {
) )
.switch("interactive", "ask user to confirm action", Some('i')) .switch("interactive", "ask user to confirm action", Some('i'))
.switch("force", "suppress error when no file", Some('f')) .switch("force", "suppress error when no file", Some('f'))
.category(Category::FileSystem)
} }
fn run( fn run(

View File

@ -9,7 +9,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, SyntaxShape, Value, Category, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, SyntaxShape,
Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -55,6 +56,7 @@ impl Command for Rm {
SyntaxShape::GlobPattern, SyntaxShape::GlobPattern,
"the file path(s) to remove", "the file path(s) to remove",
) )
.category(Category::FileSystem)
} }
fn run( fn run(

View File

@ -3,7 +3,7 @@ use std::fs::OpenOptions;
use nu_engine::CallExt; use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Touch; pub struct Touch;
@ -21,6 +21,7 @@ impl Command for Touch {
"the path of the file you want to create", "the path of the file you want to create",
) )
.rest("rest", SyntaxShape::Filepath, "additional files to create") .rest("rest", SyntaxShape::Filepath, "additional files to create")
.category(Category::FileSystem)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use nu_engine::eval_block; use nu_engine::eval_block;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, Signature, SyntaxShape, Value}; use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct Collect; pub struct Collect;
@ -12,11 +12,13 @@ impl Command for Collect {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("collect").required( Signature::build("collect")
"block", .required(
SyntaxShape::Block(Some(vec![SyntaxShape::Any])), "block",
"the block to run once the stream is collected", SyntaxShape::Block(Some(vec![SyntaxShape::Any])),
) "the block to run once the stream is collected",
)
.category(Category::Filters)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,8 +2,8 @@ use nu_engine::eval_block;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, Span, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature,
SyntaxShape, Value, Span, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -26,6 +26,7 @@ impl Command for Each {
"the block to run", "the block to run",
) )
.switch("numbered", "iterate with an index", Some('n')) .switch("numbered", "iterate with an index", Some('n'))
.category(Category::Filters)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View File

@ -2,7 +2,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
Type, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,11 +15,13 @@ impl Command for First {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("first").optional( Signature::build("first")
"rows", .optional(
SyntaxShape::Int, "rows",
"starting from the front, the number of rows to return", SyntaxShape::Int,
) "starting from the front, the number of rows to return",
)
.category(Category::Filters)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use nu_engine::CallExt; use nu_engine::CallExt;
use nu_protocol::ast::{Call, CellPath}; use nu_protocol::ast::{Call, CellPath};
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoPipelineData, PipelineData, Signature, SyntaxShape}; use nu_protocol::{Category, IntoPipelineData, PipelineData, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Get; pub struct Get;
@ -16,11 +16,13 @@ impl Command for Get {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("get").required( Signature::build("get")
"cell_path", .required(
SyntaxShape::CellPath, "cell_path",
"the cell path to the data", SyntaxShape::CellPath,
) "the cell path to the data",
)
.category(Category::Filters)
} }
fn run( fn run(

View File

@ -3,8 +3,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span,
Value, SyntaxShape, Value,
}; };
use std::convert::TryInto; use std::convert::TryInto;
@ -17,11 +17,13 @@ impl Command for Last {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("last").optional( Signature::build("last")
"rows", .optional(
SyntaxShape::Int, "rows",
"starting from the back, the number of rows to return", SyntaxShape::Int,
) "starting from the back, the number of rows to return",
)
.category(Category::Filters)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoPipelineData, PipelineData, Signature, Value}; use nu_protocol::{Category, IntoPipelineData, PipelineData, Signature, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct Length; pub struct Length;
@ -15,7 +15,7 @@ impl Command for Length {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("length") Signature::build("length").category(Category::Filters)
} }
fn run( fn run(

View File

@ -1,6 +1,8 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Value}; use nu_protocol::{
Category, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct Lines; pub struct Lines;
@ -17,7 +19,7 @@ impl Command for Lines {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("lines") Signature::build("lines").category(Category::Filters)
} }
fn run( fn run(

View File

@ -2,8 +2,8 @@ use nu_engine::eval_block;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, SyntaxShape, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature,
Value, SyntaxShape, Value,
}; };
use rayon::prelude::*; use rayon::prelude::*;
@ -27,6 +27,7 @@ impl Command for ParEach {
"the block to run", "the block to run",
) )
.switch("numbered", "iterate with an index", Some('n')) .switch("numbered", "iterate with an index", Some('n'))
.category(Category::Filters)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View File

@ -3,8 +3,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span,
Value, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -16,11 +16,13 @@ impl Command for Range {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("range").optional( Signature::build("range")
"rows", .optional(
SyntaxShape::Range, "rows",
"range of rows to return: Eg) 4..7 (=> from 4 to 7)", SyntaxShape::Range,
) "range of rows to return: Eg) 4..7 (=> from 4 to 7)",
)
.category(Category::Filters)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,8 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, Value, Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span,
Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -13,7 +14,7 @@ impl Command for Reverse {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("reverse") Signature::build("reverse").category(Category::Filters)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,8 +2,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::{Call, CellPath}; use nu_protocol::ast::{Call, CellPath};
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, Signature, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
Span, SyntaxShape, Value, Signature, Span, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -15,11 +15,13 @@ impl Command for Select {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("select").rest( Signature::build("select")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"the columns to select from the table", SyntaxShape::CellPath,
) "the columns to select from the table",
)
.category(Category::Filters)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{IntoInterruptiblePipelineData, PipelineData, ShellError, Signature}; use nu_protocol::{Category, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature};
use rand::prelude::SliceRandom; use rand::prelude::SliceRandom;
use rand::thread_rng; use rand::thread_rng;
@ -13,7 +13,7 @@ impl Command for Shuffle {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("shuffle") Signature::build("shuffle").category(Category::Filters)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,8 @@ use nu_engine::{eval_block, CallExt};
use nu_protocol::ast::{Call, CellPath}; use nu_protocol::ast::{Call, CellPath};
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -25,6 +26,7 @@ impl Command for Update {
SyntaxShape::Any, SyntaxShape::Any,
"the new value to give the cell(s)", "the new value to give the cell(s)",
) )
.category(Category::Filters)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use nu_engine::eval_expression; use nu_engine::eval_expression;
use nu_protocol::ast::{Call, Expr, Expression}; use nu_protocol::ast::{Call, Expr, Expression};
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape}; use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape};
#[derive(Clone)] #[derive(Clone)]
pub struct Where; pub struct Where;
@ -16,7 +16,9 @@ impl Command for Where {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("where").required("cond", SyntaxShape::RowCondition, "condition") Signature::build("where")
.required("cond", SyntaxShape::RowCondition, "condition")
.category(Category::Filters)
} }
fn run( fn run(

View File

@ -2,7 +2,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, SyntaxShape, Value, Category, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature,
SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -18,7 +19,9 @@ impl Command for Wrap {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("wrap").required("name", SyntaxShape::String, "the name of the column") Signature::build("wrap")
.required("name", SyntaxShape::String, "the name of the column")
.category(Category::Filters)
} }
fn run( fn run(

View File

@ -2,8 +2,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, SyntaxShape, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature,
Value, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -19,7 +19,9 @@ impl Command for Zip {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("zip").required("other", SyntaxShape::Any, "the other input") Signature::build("zip")
.required("other", SyntaxShape::Any, "the other input")
.category(Category::Filters)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature}; use nu_protocol::{Category, PipelineData, ShellError, Signature};
#[derive(Clone)] #[derive(Clone)]
pub struct From; pub struct From;
@ -15,7 +15,7 @@ impl Command for From {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("from") Signature::build("from").category(Category::Formats)
} }
fn run( fn run(

View File

@ -3,7 +3,7 @@ use super::delimited::from_delimited_data;
use nu_engine::CallExt; use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, SyntaxShape, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct FromCsv; pub struct FromCsv;
@ -26,6 +26,7 @@ impl Command for FromCsv {
"don't treat the first row as column names", "don't treat the first row as column names",
Some('n'), Some('n'),
) )
.category(Category::Formats)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -4,6 +4,7 @@ use indexmap::map::IndexMap;
use nu_engine::CallExt; use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::Category;
use nu_protocol::Config; use nu_protocol::Config;
use nu_protocol::{ use nu_protocol::{
Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
@ -20,12 +21,14 @@ impl Command for FromEml {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("from eml").named( Signature::build("from eml")
"preview-body", .named(
SyntaxShape::Int, "preview-body",
"How many bytes of the body to preview", SyntaxShape::Int,
Some('b'), "How many bytes of the body to preview",
) Some('b'),
)
.category(Category::Formats)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,8 +1,8 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, Signature, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
Span, Value, Signature, Span, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -18,11 +18,9 @@ impl Command for FromJson {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("from json").switch( Signature::build("from json")
"objects", .switch("objects", "treat each line as a separate value", Some('o'))
"treat each line as a separate value", .category(Category::Formats)
Some('o'),
)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View File

@ -2,7 +2,7 @@ use super::delimited::from_delimited_data;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Config, PipelineData, ShellError, Signature}; use nu_protocol::{Category, Config, PipelineData, ShellError, Signature};
#[derive(Clone)] #[derive(Clone)]
pub struct FromTsv; pub struct FromTsv;
@ -13,11 +13,13 @@ impl Command for FromTsv {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("from csv").switch( Signature::build("from csv")
"noheaders", .switch(
"don't treat the first row as column names", "noheaders",
Some('n'), "don't treat the first row as column names",
) Some('n'),
)
.category(Category::Formats)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Config, Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Config, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct FromUrl; pub struct FromUrl;
@ -11,7 +11,7 @@ impl Command for FromUrl {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("from url") Signature::build("from url").category(Category::Formats)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,8 @@ use itertools::Itertools;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Config, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Spanned, Value, Category, Config, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
Spanned, Value,
}; };
use serde::de::Deserialize; use serde::de::Deserialize;
use std::collections::HashMap; use std::collections::HashMap;
@ -16,7 +17,7 @@ impl Command for FromYaml {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("from yaml") Signature::build("from yaml").category(Category::Formats)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
@ -84,7 +85,7 @@ impl Command for FromYml {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("from yml") Signature::build("from yml").category(Category::Formats)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature}; use nu_protocol::{Category, PipelineData, ShellError, Signature};
#[derive(Clone)] #[derive(Clone)]
pub struct To; pub struct To;
@ -15,7 +15,7 @@ impl Command for To {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("to") Signature::build("to").category(Category::Formats)
} }
fn run( fn run(

View File

@ -1,8 +1,8 @@
use nu_protocol::ast::{Call, PathMember}; use nu_protocol::ast::{Call, PathMember};
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, Signature, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
Value, Signature, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,7 +14,7 @@ impl Command for ToJson {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("to json") Signature::build("to json").category(Category::Formats)
// .named( // .named(
// "pretty", // "pretty",
// SyntaxShape::Int, // SyntaxShape::Int,

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math abs") Signature::build("math abs").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::math::reducers::{reducer_for, Reduce};
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math avg") Signature::build("math avg").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math ceil") Signature::build("math ceil").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::get_full_help;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
IntoPipelineData, PipelineData, Signature, Value, Category, IntoPipelineData, PipelineData, Signature, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,7 +14,7 @@ impl Command for MathCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math") Signature::build("math").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -18,11 +18,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math eval").optional( Signature::build("math eval")
"math expression", .optional(
SyntaxShape::String, "math expression",
"the math expression to evaluate", SyntaxShape::String,
) "the math expression to evaluate",
)
.category(Category::Math)
} }
fn run( fn run(

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math floor") Signature::build("math floor").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::math::reducers::{reducer_for, Reduce};
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math max") Signature::build("math max").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::math::avg::average;
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math median") Signature::build("math median").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::math::reducers::{reducer_for, Reduce};
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math min") Signature::build("math min").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
use std::cmp::Ordering; use std::cmp::Ordering;
#[derive(Clone)] #[derive(Clone)]
@ -36,7 +36,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math mode") Signature::build("math mode").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::math::reducers::{reducer_for, Reduce};
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math product") Signature::build("math product").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use nu_engine::CallExt; use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -12,12 +14,14 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math round").named( Signature::build("math round")
"precision", .named(
SyntaxShape::Number, "precision",
"digits of precision", SyntaxShape::Number,
Some('p'), "digits of precision",
) Some('p'),
)
.category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math sqrt") Signature::build("math sqrt").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use super::variance::compute_variance as variance;
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,11 +13,9 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math stddev").switch( Signature::build("math stddev")
"sample", .switch("sample", "calculate sample standard deviation", Some('s'))
"calculate sample standard deviation", .category(Category::Math)
Some('s'),
)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::math::reducers::{reducer_for, Reduce};
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math sum") Signature::build("math sum").category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use crate::math::utils::run_with_function; use crate::math::utils::run_with_function;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;
@ -12,7 +12,9 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math variance").switch("sample", "calculate sample variance", Some('s')) Signature::build("math variance")
.switch("sample", "calculate sample variance", Some('s'))
.category(Category::Math)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,8 @@ use nu_engine::eval_expression;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -18,7 +19,9 @@ impl Command for BuildString {
} }
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("build-string").rest("rest", SyntaxShape::String, "list of string") Signature::build("build-string")
.rest("rest", SyntaxShape::String, "list of string")
.category(Category::Strings)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::{Call, PathMember}; use nu_protocol::ast::{Call, PathMember};
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, ValueStream, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, ValueStream,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,11 +14,13 @@ impl Command for Format {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("format").required( Signature::build("format")
"pattern", .required(
SyntaxShape::String, "pattern",
"the pattern to output. e.g.) \"{foo}: {bar}\"", SyntaxShape::String,
) "the pattern to output. e.g.) \"{foo}: {bar}\"",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,8 +2,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type,
ValueStream, Value, ValueStream,
}; };
use regex::Regex; use regex::Regex;
@ -27,6 +27,7 @@ impl Command for Parse {
"the pattern to match. Eg) \"{foo}: {bar}\"", "the pattern to match. Eg) \"{foo}: {bar}\"",
) )
.switch("regex", "use full regex syntax for patterns", Some('r')) .switch("regex", "use full regex syntax for patterns", Some('r'))
.category(Category::Strings)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View File

@ -4,7 +4,7 @@ use unicode_segmentation::UnicodeSegmentation;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, Type, Value}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Type, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct Size; pub struct Size;
@ -15,7 +15,7 @@ impl Command for Size {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("size") Signature::build("size").category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
Example, PipelineData, ShellError, Signature, Span, Type, Value, Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -13,7 +13,7 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("split chars") Signature::build("split chars").category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, Category, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -26,6 +26,7 @@ impl Command for SubCommand {
SyntaxShape::String, SyntaxShape::String,
"column names to give the new columns", "column names to give the new columns",
) )
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::get_full_help;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
IntoPipelineData, PipelineData, Signature, Value, Category, IntoPipelineData, PipelineData, Signature, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,7 +14,7 @@ impl Command for SplitCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("split") Signature::build("split").category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, Category, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,11 +14,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("split row").required( Signature::build("split row")
"separator", .required(
SyntaxShape::String, "separator",
"the character that denotes what separates rows", SyntaxShape::String,
) "the character that denotes what separates rows",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,6 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::ast::CellPath; use nu_protocol::ast::CellPath;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::Category;
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
#[derive(Clone)] #[derive(Clone)]
@ -13,11 +14,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str capitalize").rest( Signature::build("str capitalize")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"optionally capitalize text by column paths", SyntaxShape::CellPath,
) "optionally capitalize text by column paths",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::camelcase::to_camel_case; use inflector::cases::camelcase::to_camel_case;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate; use crate::operate;
@ -14,11 +16,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str camel-case").rest( Signature::build("str camel-case")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"optionally convert text to camelCase by column paths", SyntaxShape::CellPath,
) "optionally convert text to camelCase by column paths",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use nu_engine::get_full_help;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
engine::{Command, EngineState, Stack}, engine::{Command, EngineState, Stack},
IntoPipelineData, PipelineData, Signature, Value, Category, IntoPipelineData, PipelineData, Signature, Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,7 +14,7 @@ impl Command for Str {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str") Signature::build("str").category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::kebabcase::to_kebab_case; use inflector::cases::kebabcase::to_kebab_case;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate; use crate::operate;
@ -14,11 +16,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str kebab-case").rest( Signature::build("str kebab-case")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"optionally convert text to kebab-case by column paths", SyntaxShape::CellPath,
) "optionally convert text to kebab-case by column paths",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::pascalcase::to_pascal_case; use inflector::cases::pascalcase::to_pascal_case;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate; use crate::operate;
@ -14,11 +16,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str pascal-case").rest( Signature::build("str pascal-case")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"optionally convert text to PascalCase by column paths", SyntaxShape::CellPath,
) "optionally convert text to PascalCase by column paths",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::screamingsnakecase::to_screaming_snake_case; use inflector::cases::screamingsnakecase::to_screaming_snake_case;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate; use crate::operate;
#[derive(Clone)] #[derive(Clone)]
@ -13,11 +15,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str screaming-snake-case").rest( Signature::build("str screaming-snake-case")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"optionally convert text to SCREAMING_SNAKE_CASE by column paths", SyntaxShape::CellPath,
) "optionally convert text to SCREAMING_SNAKE_CASE by column paths",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::snakecase::to_snake_case; use inflector::cases::snakecase::to_snake_case;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
};
use crate::operate; use crate::operate;
#[derive(Clone)] #[derive(Clone)]
@ -13,11 +15,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str snake-case").rest( Signature::build("str snake-case")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"optionally convert text to snake_case by column paths", SyntaxShape::CellPath,
) "optionally convert text to snake_case by column paths",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"converts a string to snake_case" "converts a string to snake_case"

View File

@ -2,7 +2,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{ use nu_protocol::{
Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
Value,
}; };
#[derive(Clone)] #[derive(Clone)]
@ -14,11 +15,13 @@ impl Command for StrCollect {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str collect").optional( Signature::build("str collect")
"separator", .optional(
SyntaxShape::String, "separator",
"optional separator to use when creating string", SyntaxShape::String,
) "optional separator to use when creating string",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,6 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::ast::CellPath; use nu_protocol::ast::CellPath;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::Category;
use nu_protocol::{ use nu_protocol::{
Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
}; };
@ -23,6 +24,7 @@ impl Command for SubCommand {
"optionally check if string contains pattern by column paths", "optionally check if string contains pattern by column paths",
) )
.switch("insensitive", "search is case insensitive", Some('i')) .switch("insensitive", "search is case insensitive", Some('i'))
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,6 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::ast::CellPath; use nu_protocol::ast::CellPath;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::Category;
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
#[derive(Clone)] #[derive(Clone)]
@ -13,11 +14,13 @@ impl Command for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("str downcase").rest( Signature::build("str downcase")
"rest", .rest(
SyntaxShape::CellPath, "rest",
"optionally downcase text by column paths", SyntaxShape::CellPath,
) "optionally downcase text by column paths",
)
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -2,6 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::ast::CellPath; use nu_protocol::ast::CellPath;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::Category;
use nu_protocol::Spanned; use nu_protocol::Spanned;
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value}; use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
@ -21,6 +22,7 @@ impl Command for SubCommand {
SyntaxShape::CellPath, SyntaxShape::CellPath,
"optionally matches suffix of text by column paths", "optionally matches suffix of text by column paths",
) )
.category(Category::Strings)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

Some files were not shown because too many files have changed in this diff Show More