Update command groups with new and deprecated commands

main
trivernis 1 year ago
parent 667d672dc5
commit 9f259878dd
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: DFFFCC2C7A02DB45

@ -10,11 +10,12 @@ authors = ["trivernis <trivernis@proton.me>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
miette = "5.5.0" miette = "5.7.0"
nu-command = "0.75.0" nu-cmd-lang = "0.78.0"
nu-engine = "0.75.0" nu-command = "0.78.0"
nu-parser = "0.75.0" nu-engine = "0.78.0"
nu-protocol = "0.75.0" nu-parser = "0.78.0"
paste = "1.0.11" nu-protocol = "0.78.0"
paste = "1.0.12"
rusty-value = { version = "0.6.0", features = ["derive"] } rusty-value = { version = "0.6.0", features = ["derive"] }
thiserror = "1.0.38" thiserror = "1.0.40"

@ -1,25 +1,27 @@
use nu_cmd_lang::*;
use nu_command::*; use nu_command::*;
use nu_protocol::engine::{EngineState, StateWorkingSet}; use nu_protocol::engine::{EngineState, StateWorkingSet};
use crate::error::CrateResult; use crate::error::CrateResult;
macro_rules! bind_commands { macro_rules! bind_commands {
($engine_state:expr, $( $command:expr),* $(,)? ) => { ($engine_state:expr, $( $command:expr),* $(,)? ) => {
bind($engine_state, |working_set| { bind($engine_state, |working_set| {
$( working_set.add_decl(Box::new($command)); )* $( working_set.add_decl(Box::new($command)); )*
}) })
}; };
} }
pub fn bind_core_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_core_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands!( bind_commands!(
engine_state, engine_state,
Metadata,
Alias, Alias,
Ast,
Break, Break,
Collect,
Commandline, Commandline,
Const,
Continue, Continue,
Debug,
Def, Def,
DefEnv, DefEnv,
Describe, Describe,
@ -35,6 +37,10 @@ pub fn bind_core_commands(engine_state: &mut EngineState) -> CrateResult<()> {
Extern, Extern,
For, For,
Help, Help,
HelpAliases,
HelpCommands,
HelpModules,
HelpExterns,
HelpOperators, HelpOperators,
Hide, Hide,
HideEnv, HideEnv,
@ -46,7 +52,8 @@ pub fn bind_core_commands(engine_state: &mut EngineState) -> CrateResult<()> {
OverlayNew, OverlayNew,
OverlayHide, OverlayHide,
Let, Let,
Metadata, Loop,
Match,
Module, Module,
Mut, Mut,
Return, Return,
@ -57,6 +64,23 @@ pub fn bind_core_commands(engine_state: &mut EngineState) -> CrateResult<()> {
) )
} }
pub fn bind_debug_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands!(
engine_state,
Ast,
Debug,
Explain,
Inspect,
Metadata,
Profile,
TimeIt,
View,
ViewFiles,
ViewSource,
ViewSpan,
)
}
pub fn bind_chart_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_chart_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands!(engine_state, Histogram) bind_commands!(engine_state, Histogram)
} }
@ -64,67 +88,72 @@ pub fn bind_chart_commands(engine_state: &mut EngineState) -> CrateResult<()> {
pub fn bind_filter_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_filter_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
All, All,
Any, Any,
Append, Append,
Collect, Columns,
Columns, Compact,
Compact, Default,
Default, Drop,
Drop, DropColumn,
DropColumn, DropNth,
DropNth, Each,
Each, EachWhile,
EachWhile, Empty,
Empty, Enumerate,
Every, Every,
Find, Filter,
First, Find,
Flatten, First,
Get, Flatten,
Group, Get,
GroupBy, Group,
Headers, GroupBy,
Insert, Headers,
SplitBy, Insert,
Take, Join,
Merge, SplitBy,
Move, Take,
TakeWhile, Merge,
TakeUntil, Move,
Last, TakeWhile,
Length, TakeUntil,
Lines, Last,
ParEach, Length,
Prepend, Lines,
Range, ParEach,
Reduce, Prepend,
Reject, Range,
Rename, Reduce,
Reverse, Reject,
Roll, Rename,
RollDown, Reverse,
RollUp, Roll,
RollLeft, RollDown,
RollRight, RollUp,
Rotate, RollLeft,
Select, RollRight,
Shuffle, Rotate,
Skip, Select,
SkipUntil, Shuffle,
SkipWhile, Skip,
Sort, SkipUntil,
SortBy, SkipWhile,
SplitList, Sort,
Transpose, SortBy,
Uniq, SplitList,
Upsert, Transpose,
Update, Uniq,
UpdateCells, UniqBy,
Where, Upsert,
Window, Update,
Wrap, UpdateCells,
Zip, } Values,
Where,
Window,
Wrap,
Zip,
}
} }
pub fn bind_misc_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_misc_commands(engine_state: &mut EngineState) -> CrateResult<()> {
@ -134,16 +163,16 @@ pub fn bind_misc_commands(engine_state: &mut EngineState) -> CrateResult<()> {
pub fn bind_path_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_path_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Path, Path,
PathBasename, PathBasename,
PathDirname, PathDirname,
PathExists, PathExists,
PathExpand, PathExpand,
PathJoin, PathJoin,
PathParse, PathParse,
PathRelativeTo, PathRelativeTo,
PathSplit, PathSplit,
PathType, PathType,
} }
} }
@ -151,7 +180,6 @@ pub fn bind_path_commands(engine_state: &mut EngineState) -> CrateResult<()> {
pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Benchmark,
Complete, Complete,
External, External,
NuCheck, NuCheck,
@ -166,7 +194,6 @@ pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> {
pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Benchmark,
Complete, Complete,
External, External,
NuCheck, NuCheck,
@ -181,7 +208,6 @@ pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> {
pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Benchmark,
Complete, Complete,
External, External,
NuCheck, NuCheck,
@ -194,45 +220,44 @@ pub fn bind_system_commands(engine_state: &mut EngineState) -> CrateResult<()> {
pub fn bind_string_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_string_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Char, Char,
Decode, Decode,
Encode, Encode,
DecodeBase64, DecodeBase64,
EncodeBase64, EncodeBase64,
DetectColumns, DecodeHex,
Format, EncodeHex,
FileSize, DetectColumns,
Parse, Format,
Size, FileSize,
Split, Parse,
SplitChars, Size,
SplitColumn, Split,
SplitRow, SplitChars,
SplitWords, SplitColumn,
Str, SplitRow,
StrCamelCase, SplitWords,
StrCapitalize, Str,
StrCollect, StrCamelCase,
StrContains, StrCapitalize,
StrDistance, StrContains,
StrDowncase, StrDistance,
StrEndswith, StrDowncase,
StrJoin, StrEndswith,
StrReplace, StrJoin,
StrIndexOf, StrReplace,
StrKebabCase, StrIndexOf,
StrLength, StrKebabCase,
StrLpad, StrLength,
StrPascalCase, StrPascalCase,
StrReverse, StrReverse,
StrRpad, StrScreamingSnakeCase,
StrScreamingSnakeCase, StrSnakeCase,
StrSnakeCase, StrStartsWith,
StrStartsWith, StrSubstring,
StrSubstring, StrTrim,
StrTrim, StrTitleCase,
StrTitleCase, StrUpcase
StrUpcase,
} }
} }
@ -334,38 +359,33 @@ pub fn bind_shell_commands(engine_state: &mut EngineState) -> CrateResult<()> {
pub fn bind_format_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_format_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
From, From,
FromCsv, FromCsv,
FromEml, FromJson,
FromIcs, FromNuon,
FromIni, FromOds,
FromJson, FromSsv,
FromNuon, FromToml,
FromOds, FromTsv,
FromSsv, FromUrl,
FromToml, FromXlsx,
FromTsv, FromXml,
FromUrl, FromYaml,
FromVcf, FromYml,
FromXlsx, To,
FromXml, ToCsv,
FromYaml, ToHtml,
FromYml, ToJson,
To, ToMd,
ToCsv, ToNuon,
ToHtml, ToText,
ToJson, ToToml,
ToMd, ToTsv,
ToNuon, Touch,
ToText, Upsert,
ToToml, Where,
ToTsv, ToXml,
Touch, ToYaml,
Use,
Upsert,
Where,
ToXml,
ToYaml,
} }
} }
@ -374,12 +394,14 @@ pub fn bind_viewer_commands(engine_state: &mut EngineState) -> CrateResult<()> {
engine_state, engine_state,
Griddle, Griddle,
Table, Table,
Explore,
} }
} }
pub fn bind_conversion_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_conversion_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Fill,
Fmt, Fmt,
Into, Into,
IntoBool, IntoBool,
@ -397,12 +419,11 @@ pub fn bind_conversion_commands(engine_state: &mut EngineState) -> CrateResult<(
pub fn bind_environment_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_environment_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Env, ExportEnv,
ExportEnv, LetEnv,
LetEnv, LoadEnv,
LoadEnv, SourceEnv,
SourceEnv, WithEnv,
WithEnv,
// nu config commands have been removed as editing isn't possible // nu config commands have been removed as editing isn't possible
// in this environment // in this environment
} }
@ -411,30 +432,58 @@ pub fn bind_environment_commands(engine_state: &mut EngineState) -> CrateResult<
pub fn bind_math_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_math_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Math, Math,
MathAbs, MathAbs,
MathAvg, MathAvg,
MathCeil, MathCeil,
MathFloor, MathFloor,
MathMax, MathMax,
MathMedian, MathMedian,
MathMin, MathMin,
MathMode, MathMode,
MathProduct, MathProduct,
MathRound, MathRound,
MathSqrt, MathSqrt,
MathStddev, MathStddev,
MathSum, MathSum,
MathVariance, MathVariance,
MathSin,
MathCos,
MathTan,
MathSinH,
MathCosH,
MathTanH,
MathArcSin,
MathArcCos,
MathArcTan,
MathArcSinH,
MathArcCosH,
MathArcTanH,
MathPi,
MathTau,
MathEuler,
MathExp,
MathLn,
MathLog,
} }
} }
pub fn bind_network_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_network_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
Url, Http,
UrlParse, HttpDelete,
Port, HttpGet,
HttpHead,
HttpPatch,
HttpPost,
HttpPut,
Url,
UrlBuildQuery,
UrlEncode,
UrlJoin,
UrlParse,
Port,
} }
} }
@ -473,7 +522,6 @@ pub fn bind_hash_commands(engine_state: &mut EngineState) -> CrateResult<()> {
pub fn bind_experimental_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_experimental_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
ViewSource,
IsAdmin, IsAdmin,
} }
} }

@ -47,6 +47,7 @@ impl ContextBuilder {
toggle_command_groups!( toggle_command_groups!(
core, core,
debug,
filter, filter,
chart, chart,
misc, misc,

@ -36,6 +36,8 @@ macro_rules! command_group_config {
command_group_config!( command_group_config!(
/// Enables core commands /// Enables core commands
core, core,
/// Enables debug commands
debug,
/// Enables filter commands /// Enables filter commands
filter, filter,
/// Enables chart commands /// Enables chart commands

Loading…
Cancel
Save