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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::{
ast::{Call, CellPath},
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)
@ -29,6 +29,7 @@ impl Command for SubCommand {
"decimal digits to which to round",
Some('d'),
)
.category(Category::Conversions)
}
fn usage(&self) -> &str {

View File

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

View File

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

View File

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

View File

@ -1,7 +1,9 @@
use nu_engine::CallExt;
use nu_protocol::ast::Call;
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)]
pub struct Echo;
@ -16,7 +18,9 @@ impl Command for Echo {
}
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(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,9 @@
use nu_engine::{eval_block, eval_expression};
use nu_protocol::ast::Call;
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)]
pub struct If;
@ -24,6 +26,7 @@ impl Command for If {
SyntaxShape::Keyword(b"else".to_vec(), Box::new(SyntaxShape::Expression)),
"optional else followed by else block",
)
.category(Category::Core)
}
fn run(

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
use nu_engine::{eval_block, CallExt};
use nu_protocol::ast::Call;
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.
#[derive(Clone)]
@ -13,11 +13,13 @@ impl Command for Source {
}
fn signature(&self) -> Signature {
Signature::build("source").required(
"filename",
SyntaxShape::Filepath,
"the filepath to the script file to source",
)
Signature::build("source")
.required(
"filename",
SyntaxShape::Filepath,
"the filepath to the script file to source",
)
.category(Category::Core)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use nu_engine::eval_block;
use nu_protocol::ast::{Call, Expr, Expression, ImportPatternMember};
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)]
pub struct Use;
@ -16,7 +16,9 @@ impl Command for Use {
}
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(

View File

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

View File

@ -3,7 +3,7 @@ use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
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};
@ -17,11 +17,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("date format").required(
"format string",
SyntaxShape::String,
"the desired date format",
)
Signature::build("date format")
.required(
"format string",
SyntaxShape::String,
"the desired date format",
)
.category(Category::Date)
}
fn usage(&self) -> &str {

View File

@ -3,7 +3,7 @@ use chrono::{DateTime, FixedOffset, Local};
use chrono_humanize::HumanTime;
use nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("date humanize")
Signature::build("date humanize").category(Category::Date)
}
fn usage(&self) -> &str {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape};
use nu_protocol::{Category, PipelineData, Signature, SyntaxShape};
#[derive(Clone)]
pub struct Cd;
@ -16,7 +16,9 @@ impl Command for Cd {
}
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(

View File

@ -6,7 +6,7 @@ use nu_engine::CallExt;
use nu_path::canonicalize_with;
use nu_protocol::ast::Call;
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;
@ -34,6 +34,7 @@ impl Command for Cp {
)
.switch("force", "suppress error when no file", Some('f'))
.switch("interactive", "ask user to confirm action", Some('i'))
.category(Category::FileSystem)
}
fn run(

View File

@ -3,7 +3,9 @@ use lscolors::{LsColors, Style};
use nu_engine::eval_expression;
use nu_protocol::ast::Call;
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)]
pub struct Ls;
@ -19,11 +21,13 @@ impl Command for Ls {
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("ls").optional(
"pattern",
SyntaxShape::GlobPattern,
"the glob pattern to use",
)
Signature::build("ls")
.optional(
"pattern",
SyntaxShape::GlobPattern,
"the glob pattern to use",
)
.category(Category::FileSystem)
}
fn run(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,8 @@
use nu_protocol::ast::Call;
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)]
pub struct Lines;
@ -17,7 +19,7 @@ impl Command for Lines {
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("lines")
Signature::build("lines").category(Category::Filters)
}
fn run(

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
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::thread_rng;
@ -13,7 +13,7 @@ impl Command for Shuffle {
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("shuffle")
Signature::build("shuffle").category(Category::Filters)
}
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::engine::{Command, EngineState, Stack};
use nu_protocol::{
Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
Value,
};
#[derive(Clone)]
@ -25,6 +26,7 @@ impl Command for Update {
SyntaxShape::Any,
"the new value to give the cell(s)",
)
.category(Category::Filters)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use nu_engine::eval_expression;
use nu_protocol::ast::{Call, Expr, Expression};
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape};
use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape};
#[derive(Clone)]
pub struct Where;
@ -16,7 +16,9 @@ impl Command for Where {
}
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(

View File

@ -2,7 +2,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, SyntaxShape, Value,
Category, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature,
SyntaxShape, Value,
};
#[derive(Clone)]
@ -18,7 +19,9 @@ impl Command for Wrap {
}
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(

View File

@ -2,8 +2,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, SyntaxShape,
Value,
Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature,
SyntaxShape, Value,
};
#[derive(Clone)]
@ -19,7 +19,9 @@ impl Command for Zip {
}
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> {

View File

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

View File

@ -3,7 +3,7 @@ use super::delimited::from_delimited_data;
use nu_engine::CallExt;
use nu_protocol::ast::Call;
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)]
pub struct FromCsv;
@ -26,6 +26,7 @@ impl Command for FromCsv {
"don't treat the first row as column names",
Some('n'),
)
.category(Category::Formats)
}
fn usage(&self) -> &str {

View File

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

View File

@ -1,8 +1,8 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, Signature,
Span, Value,
Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
Signature, Span, Value,
};
#[derive(Clone)]
@ -18,11 +18,9 @@ impl Command for FromJson {
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("from json").switch(
"objects",
"treat each line as a separate value",
Some('o'),
)
Signature::build("from json")
.switch("objects", "treat each line as a separate value", Some('o'))
.category(Category::Formats)
}
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::engine::{Command, EngineState, Stack};
use nu_protocol::{Config, PipelineData, ShellError, Signature};
use nu_protocol::{Category, Config, PipelineData, ShellError, Signature};
#[derive(Clone)]
pub struct FromTsv;
@ -13,11 +13,13 @@ impl Command for FromTsv {
}
fn signature(&self) -> Signature {
Signature::build("from csv").switch(
"noheaders",
"don't treat the first row as column names",
Some('n'),
)
Signature::build("from csv")
.switch(
"noheaders",
"don't treat the first row as column names",
Some('n'),
)
.category(Category::Formats)
}
fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
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)]
pub struct FromUrl;
@ -11,7 +11,7 @@ impl Command for FromUrl {
}
fn signature(&self) -> Signature {
Signature::build("from url")
Signature::build("from url").category(Category::Formats)
}
fn usage(&self) -> &str {

View File

@ -2,7 +2,8 @@ use itertools::Itertools;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
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 std::collections::HashMap;
@ -16,7 +17,7 @@ impl Command for FromYaml {
}
fn signature(&self) -> Signature {
Signature::build("from yaml")
Signature::build("from yaml").category(Category::Formats)
}
fn usage(&self) -> &str {
@ -84,7 +85,7 @@ impl Command for FromYml {
}
fn signature(&self) -> Signature {
Signature::build("from yml")
Signature::build("from yml").category(Category::Formats)
}
fn usage(&self) -> &str {

View File

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

View File

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

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math abs")
Signature::build("math abs").category(Category::Math)
}
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 nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math avg")
Signature::build("math avg").category(Category::Math)
}
fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math ceil")
Signature::build("math ceil").category(Category::Math)
}
fn usage(&self) -> &str {

View File

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

View File

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

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math floor")
Signature::build("math floor").category(Category::Math)
}
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 nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math max")
Signature::build("math max").category(Category::Math)
}
fn usage(&self) -> &str {

View File

@ -2,7 +2,7 @@ use crate::math::avg::average;
use crate::math::utils::run_with_function;
use nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math median")
Signature::build("math median").category(Category::Math)
}
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 nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math min")
Signature::build("math min").category(Category::Math)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use crate::math::utils::run_with_function;
use nu_protocol::ast::Call;
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;
#[derive(Clone)]
@ -36,7 +36,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math mode")
Signature::build("math mode").category(Category::Math)
}
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 nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math product")
Signature::build("math product").category(Category::Math)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use nu_engine::CallExt;
use nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -12,12 +14,14 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math round").named(
"precision",
SyntaxShape::Number,
"digits of precision",
Some('p'),
)
Signature::build("math round")
.named(
"precision",
SyntaxShape::Number,
"digits of precision",
Some('p'),
)
.category(Category::Math)
}
fn usage(&self) -> &str {

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -11,7 +11,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math sqrt")
Signature::build("math sqrt").category(Category::Math)
}
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 nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -13,11 +13,9 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math stddev").switch(
"sample",
"calculate sample standard deviation",
Some('s'),
)
Signature::build("math stddev")
.switch("sample", "calculate sample standard deviation", Some('s'))
.category(Category::Math)
}
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 nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -13,7 +13,7 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("math sum")
Signature::build("math sum").category(Category::Math)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,7 @@
use crate::math::utils::run_with_function;
use nu_protocol::ast::Call;
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)]
pub struct SubCommand;
@ -12,7 +12,9 @@ impl Command for SubCommand {
}
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 {

View File

@ -2,7 +2,8 @@ use nu_engine::eval_expression;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Value,
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
Value,
};
#[derive(Clone)]
@ -18,7 +19,9 @@ impl Command for BuildString {
}
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> {

View File

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

View File

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

View File

@ -4,7 +4,7 @@ use unicode_segmentation::UnicodeSegmentation;
use nu_protocol::ast::Call;
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)]
pub struct Size;
@ -15,7 +15,7 @@ impl Command for Size {
}
fn signature(&self) -> Signature {
Signature::build("size")
Signature::build("size").category(Category::Strings)
}
fn usage(&self) -> &str {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,9 @@
use inflector::cases::camelcase::to_camel_case;
use nu_protocol::ast::Call;
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;
@ -14,11 +16,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("str camel-case").rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to camelCase by column paths",
)
Signature::build("str camel-case")
.rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to camelCase by column paths",
)
.category(Category::Strings)
}
fn usage(&self) -> &str {

View File

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

View File

@ -1,7 +1,9 @@
use inflector::cases::kebabcase::to_kebab_case;
use nu_protocol::ast::Call;
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;
@ -14,11 +16,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("str kebab-case").rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to kebab-case by column paths",
)
Signature::build("str kebab-case")
.rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to kebab-case by column paths",
)
.category(Category::Strings)
}
fn usage(&self) -> &str {

View File

@ -1,7 +1,9 @@
use inflector::cases::pascalcase::to_pascal_case;
use nu_protocol::ast::Call;
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;
@ -14,11 +16,13 @@ impl Command for SubCommand {
}
fn signature(&self) -> Signature {
Signature::build("str pascal-case").rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to PascalCase by column paths",
)
Signature::build("str pascal-case")
.rest(
"rest",
SyntaxShape::CellPath,
"optionally convert text to PascalCase by column paths",
)
.category(Category::Strings)
}
fn usage(&self) -> &str {

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::ast::CellPath;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::Category;
use nu_protocol::{
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",
)
.switch("insensitive", "search is case insensitive", Some('i'))
.category(Category::Strings)
}
fn usage(&self) -> &str {

View File

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

View File

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

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