2021-03-31 07:52:34 +02:00
|
|
|
use crate::prelude::*;
|
2021-01-10 03:50:49 +01:00
|
|
|
use nu_engine::whole_stream_command;
|
2021-01-01 03:12:16 +01:00
|
|
|
use std::error::Error;
|
|
|
|
|
2021-04-04 07:14:58 +02:00
|
|
|
pub fn create_default_context(interactive: bool) -> Result<EvaluationContext, Box<dyn Error>> {
|
2021-05-03 01:45:55 +02:00
|
|
|
let context = EvaluationContext::basic();
|
2021-01-01 03:12:16 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
use crate::commands::*;
|
|
|
|
|
|
|
|
context.add_commands(vec![
|
|
|
|
// Fundamentals
|
|
|
|
whole_stream_command(NuPlugin),
|
2021-01-05 00:30:55 +01:00
|
|
|
whole_stream_command(Let),
|
|
|
|
whole_stream_command(LetEnv),
|
2021-06-19 05:00:07 +02:00
|
|
|
whole_stream_command(UnletEnv),
|
2021-05-25 20:18:20 +02:00
|
|
|
whole_stream_command(LoadEnv),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Def),
|
|
|
|
whole_stream_command(Source),
|
2021-06-10 03:13:08 +02:00
|
|
|
whole_stream_command(Alias),
|
2021-08-17 15:56:35 +02:00
|
|
|
whole_stream_command(Unalias),
|
2021-06-18 03:04:51 +02:00
|
|
|
whole_stream_command(Ignore),
|
2021-08-21 09:41:54 +02:00
|
|
|
whole_stream_command(Tutor),
|
2021-08-27 10:48:41 +02:00
|
|
|
whole_stream_command(Find),
|
2021-01-01 03:12:16 +01:00
|
|
|
// System/file operations
|
Create errors from tables. (#3986)
```
> [
[ msg, labels, span];
["The message", "Helpful message here", ([[start, end]; [0, 141]])]
] | error make
error: The message
┌─ shell:1:1
│
1 │ ╭ [
2 │ │ [ msg, labels, span];
3 │ │ ["The message", "Helpful message here", ([[start, end]; [0, 141]])]
│ ╰─────────────────────────────────────────────────────────────────────^ Helpful message here
```
Adding a more flexible approach for creating error values. One use case, for instance is the
idea of a test framework. A failed assertion instead of printing to the screen it could create
tables with more details of the failed assertion and pass it to this command for making a full
fledge error that Nu can show. This can (and should) be extended for capturing error values as well
in the pipeline. One could also use it for inspection.
For example: `.... | error inspect { # inspection here }`
or "error handling" as well, like so: `.... | error capture { fix here }`
However, we start here only with `error make` that creates an error value for you with limited support for the time being.
2021-09-03 04:07:26 +02:00
|
|
|
whole_stream_command(ErrorMake),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Exec),
|
|
|
|
whole_stream_command(Pwd),
|
|
|
|
whole_stream_command(Ls),
|
|
|
|
whole_stream_command(Du),
|
|
|
|
whole_stream_command(Cd),
|
|
|
|
whole_stream_command(Remove),
|
|
|
|
whole_stream_command(Open),
|
2021-06-25 05:58:37 +02:00
|
|
|
whole_stream_command(Pathvar),
|
|
|
|
whole_stream_command(PathvarAdd),
|
|
|
|
whole_stream_command(PathvarRemove),
|
|
|
|
whole_stream_command(PathvarReset),
|
|
|
|
whole_stream_command(PathvarAppend),
|
|
|
|
whole_stream_command(PathvarSave),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Config),
|
|
|
|
whole_stream_command(ConfigGet),
|
|
|
|
whole_stream_command(ConfigSet),
|
|
|
|
whole_stream_command(ConfigSetInto),
|
|
|
|
whole_stream_command(ConfigClear),
|
|
|
|
whole_stream_command(ConfigRemove),
|
|
|
|
whole_stream_command(ConfigPath),
|
|
|
|
whole_stream_command(Help),
|
|
|
|
whole_stream_command(History),
|
|
|
|
whole_stream_command(Save),
|
|
|
|
whole_stream_command(Touch),
|
|
|
|
whole_stream_command(Cpy),
|
|
|
|
whole_stream_command(Date),
|
|
|
|
whole_stream_command(DateListTimeZone),
|
|
|
|
whole_stream_command(DateNow),
|
|
|
|
whole_stream_command(DateToTable),
|
|
|
|
whole_stream_command(DateToTimeZone),
|
|
|
|
whole_stream_command(DateFormat),
|
2021-07-25 07:33:31 +02:00
|
|
|
whole_stream_command(DateHumanize),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Cal),
|
|
|
|
whole_stream_command(Mkdir),
|
|
|
|
whole_stream_command(Mv),
|
|
|
|
whole_stream_command(Kill),
|
|
|
|
whole_stream_command(Version),
|
|
|
|
whole_stream_command(Clear),
|
|
|
|
whole_stream_command(Describe),
|
|
|
|
whole_stream_command(Which),
|
|
|
|
whole_stream_command(Debug),
|
|
|
|
whole_stream_command(WithEnv),
|
|
|
|
whole_stream_command(Do),
|
|
|
|
whole_stream_command(Sleep),
|
|
|
|
// Statistics
|
|
|
|
whole_stream_command(Size),
|
2021-03-13 22:46:40 +01:00
|
|
|
whole_stream_command(Length),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Benchmark),
|
|
|
|
// Metadata
|
|
|
|
whole_stream_command(Tags),
|
|
|
|
// Shells
|
|
|
|
whole_stream_command(Next),
|
|
|
|
whole_stream_command(Previous),
|
|
|
|
whole_stream_command(Shells),
|
|
|
|
whole_stream_command(Enter),
|
|
|
|
whole_stream_command(Exit),
|
|
|
|
// Viz
|
|
|
|
whole_stream_command(Chart),
|
|
|
|
// Viewers
|
|
|
|
whole_stream_command(Autoview),
|
|
|
|
whole_stream_command(Table),
|
|
|
|
// Text manipulation
|
|
|
|
whole_stream_command(Hash),
|
|
|
|
whole_stream_command(HashBase64),
|
2021-07-29 17:22:16 +02:00
|
|
|
whole_stream_command(HashMd5::default()),
|
|
|
|
whole_stream_command(HashSha256::default()),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Split),
|
|
|
|
whole_stream_command(SplitColumn),
|
|
|
|
whole_stream_command(SplitRow),
|
|
|
|
whole_stream_command(SplitChars),
|
|
|
|
whole_stream_command(Lines),
|
|
|
|
whole_stream_command(Echo),
|
|
|
|
whole_stream_command(Parse),
|
|
|
|
whole_stream_command(Str),
|
|
|
|
whole_stream_command(StrToDecimal),
|
|
|
|
whole_stream_command(StrToInteger),
|
|
|
|
whole_stream_command(StrDowncase),
|
|
|
|
whole_stream_command(StrUpcase),
|
|
|
|
whole_stream_command(StrCapitalize),
|
|
|
|
whole_stream_command(StrFindReplace),
|
|
|
|
whole_stream_command(StrSubstring),
|
|
|
|
whole_stream_command(StrToDatetime),
|
|
|
|
whole_stream_command(StrContains),
|
|
|
|
whole_stream_command(StrIndexOf),
|
|
|
|
whole_stream_command(StrTrim),
|
|
|
|
whole_stream_command(StrStartsWith),
|
|
|
|
whole_stream_command(StrEndsWith),
|
|
|
|
whole_stream_command(StrCollect),
|
|
|
|
whole_stream_command(StrLength),
|
|
|
|
whole_stream_command(StrLPad),
|
|
|
|
whole_stream_command(StrReverse),
|
|
|
|
whole_stream_command(StrRPad),
|
|
|
|
whole_stream_command(StrCamelCase),
|
|
|
|
whole_stream_command(StrPascalCase),
|
|
|
|
whole_stream_command(StrKebabCase),
|
|
|
|
whole_stream_command(StrSnakeCase),
|
|
|
|
whole_stream_command(StrScreamingSnakeCase),
|
|
|
|
whole_stream_command(BuildString),
|
|
|
|
whole_stream_command(Ansi),
|
2021-02-23 21:16:13 +01:00
|
|
|
whole_stream_command(AnsiStrip),
|
2021-06-07 20:20:05 +02:00
|
|
|
whole_stream_command(AnsiGradient),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Char),
|
|
|
|
// Column manipulation
|
Allow dropping columns. (#3107)
`drop` is used for removing the last row. Passing a number allows dropping N rows.
Here we introduce the same logic for dropping columns instead.
You can certainly remove columns by using `reject`, however, there could be cases
where we are interested in removing columns from tables that contain, say, a big
number of columns. Using `reject` becomes impractical, especially when you don't
care about the column names that could either be known or not known when exploring
tables.
```
> echo [[lib, extension]; [nu-core, rs] [rake, rb]]
─────────┬───────────
lib │ extension
─────────┼───────────
nu-core │ rs
rake │ rb
─────────┴───────────
```
```
> echo [[lib, extension]; [nu-core, rs] [rake, rb]] | drop column
─────────
lib
─────────
nu-core
rake
─────────
```
2021-02-25 21:37:21 +01:00
|
|
|
whole_stream_command(DropColumn),
|
2021-06-19 02:06:44 +02:00
|
|
|
whole_stream_command(MoveColumn),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Reject),
|
|
|
|
whole_stream_command(Select),
|
|
|
|
whole_stream_command(Get),
|
|
|
|
whole_stream_command(Update),
|
|
|
|
whole_stream_command(Insert),
|
2021-04-10 18:29:11 +02:00
|
|
|
whole_stream_command(Into),
|
2021-05-01 18:12:25 +02:00
|
|
|
whole_stream_command(IntoBinary),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(IntoInt),
|
2021-07-23 09:14:02 +02:00
|
|
|
whole_stream_command(IntoFilepath),
|
2021-09-03 01:19:54 +02:00
|
|
|
whole_stream_command(IntoFilesize),
|
2021-05-10 19:58:51 +02:00
|
|
|
whole_stream_command(IntoString),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(SplitBy),
|
|
|
|
// Row manipulation
|
2021-04-03 20:40:54 +02:00
|
|
|
whole_stream_command(All),
|
|
|
|
whole_stream_command(Any),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Reverse),
|
|
|
|
whole_stream_command(Append),
|
|
|
|
whole_stream_command(Prepend),
|
|
|
|
whole_stream_command(SortBy),
|
|
|
|
whole_stream_command(GroupBy),
|
|
|
|
whole_stream_command(GroupByDate),
|
|
|
|
whole_stream_command(First),
|
|
|
|
whole_stream_command(Last),
|
|
|
|
whole_stream_command(Every),
|
|
|
|
whole_stream_command(Nth),
|
|
|
|
whole_stream_command(Drop),
|
2021-08-13 19:48:05 +02:00
|
|
|
whole_stream_command(DropNth),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Format),
|
|
|
|
whole_stream_command(FileSize),
|
|
|
|
whole_stream_command(Where),
|
|
|
|
whole_stream_command(If),
|
|
|
|
whole_stream_command(Compact),
|
|
|
|
whole_stream_command(Default),
|
|
|
|
whole_stream_command(Skip),
|
|
|
|
whole_stream_command(SkipUntil),
|
|
|
|
whole_stream_command(SkipWhile),
|
|
|
|
whole_stream_command(Keep),
|
|
|
|
whole_stream_command(KeepUntil),
|
|
|
|
whole_stream_command(KeepWhile),
|
|
|
|
whole_stream_command(Range),
|
|
|
|
whole_stream_command(Rename),
|
|
|
|
whole_stream_command(Uniq),
|
|
|
|
whole_stream_command(Each),
|
|
|
|
whole_stream_command(EachGroup),
|
|
|
|
whole_stream_command(EachWindow),
|
|
|
|
whole_stream_command(Empty),
|
2021-05-28 00:32:45 +02:00
|
|
|
whole_stream_command(ForIn),
|
2021-01-01 03:12:16 +01:00
|
|
|
// Table manipulation
|
|
|
|
whole_stream_command(Flatten),
|
|
|
|
whole_stream_command(Merge),
|
|
|
|
whole_stream_command(Shuffle),
|
|
|
|
whole_stream_command(Wrap),
|
|
|
|
whole_stream_command(Pivot),
|
|
|
|
whole_stream_command(Headers),
|
|
|
|
whole_stream_command(Reduce),
|
2021-02-23 19:29:07 +01:00
|
|
|
whole_stream_command(Roll),
|
|
|
|
whole_stream_command(RollColumn),
|
|
|
|
whole_stream_command(RollUp),
|
90 degree table rotations (clockwise and counter-clockwise) (#3086)
Also for 180 degree is expected. Rotation is not exactly like pivoting (transposing)
for instance, given the following table:
```
> echo [[col1, col2, col3]; [cell1, cell2, cell3] [cell4, cell5, cell6]]
───┬───────┬───────┬───────
# │ col1 │ col2 │ col3
───┼───────┼───────┼───────
0 │ cell1 │ cell2 │ cell3
1 │ cell4 │ cell5 │ cell6
───┴───────┴───────┴───────
```
To rotate it counter clockwise by 90 degrees, we can resort to first transposing (`pivot`)
them adding a new column (preferably integers), sort by that column from highest to lowest,
then remove the column and we have a counter clockwise rotation.
```
> echo [[col1, col2, col3]; [cell1, cell2, cell3] [cell4, cell5, cell6]] | pivot | each --numbered { = $it.item | insert idx $it.index } | sort-by idx | reverse | reject idx
───┬─────────┬─────────┬─────────
# │ Column0 │ Column1 │ Column2
───┼─────────┼─────────┼─────────
0 │ col3 │ cell3 │ cell6
1 │ col2 │ cell2 │ cell5
2 │ col1 │ cell1 │ cell4
───┴─────────┴─────────┴─────────
```
Which we can get easily, in this case, by doing:
```
> echo [[col1, col2, cel3]; [cell1, cell2, cell3] [cell4, cell5, cell6]] | rotate counter-clockwise
───┬─────────┬─────────┬─────────
# │ Column0 │ Column1 │ Column2
───┼─────────┼─────────┼─────────
0 │ col3 │ cell3 │ cell6
1 │ col2 │ cell2 │ cell5
2 │ col1 │ cell1 │ cell4
───┴─────────┴─────────┴─────────
```
There are also many powerful use cases with rotation, it makes a breeze creating tables with many columns, say:
```
echo 0..12 | rotate counter-clockwise | reject Column0
───┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬──────────┬──────────┬──────────┬──────────
# │ Column1 │ Column2 │ Column3 │ Column4 │ Column5 │ Column6 │ Column7 │ Column8 │ Column9 │ Column10 │ Column11 │ Column12 │ Column13
───┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────┼──────────┼──────────
0 │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12
───┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴──────────┴──────────┴──────────┴──────────
```
2021-02-22 12:56:34 +01:00
|
|
|
whole_stream_command(Rotate),
|
|
|
|
whole_stream_command(RotateCounterClockwise),
|
2021-08-15 06:36:08 +02:00
|
|
|
whole_stream_command(Zip),
|
2021-06-21 02:31:01 +02:00
|
|
|
whole_stream_command(Collect),
|
2021-01-01 03:12:16 +01:00
|
|
|
// Data processing
|
|
|
|
whole_stream_command(Histogram),
|
|
|
|
whole_stream_command(Autoenv),
|
|
|
|
whole_stream_command(AutoenvTrust),
|
2021-06-19 02:06:44 +02:00
|
|
|
whole_stream_command(AutoenvUntrust),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(Math),
|
|
|
|
whole_stream_command(MathAbs),
|
|
|
|
whole_stream_command(MathAverage),
|
|
|
|
whole_stream_command(MathEval),
|
|
|
|
whole_stream_command(MathMedian),
|
|
|
|
whole_stream_command(MathMinimum),
|
|
|
|
whole_stream_command(MathMode),
|
|
|
|
whole_stream_command(MathMaximum),
|
|
|
|
whole_stream_command(MathStddev),
|
|
|
|
whole_stream_command(MathSummation),
|
|
|
|
whole_stream_command(MathVariance),
|
|
|
|
whole_stream_command(MathProduct),
|
|
|
|
whole_stream_command(MathRound),
|
|
|
|
whole_stream_command(MathFloor),
|
|
|
|
whole_stream_command(MathCeil),
|
2021-04-01 23:26:05 +02:00
|
|
|
whole_stream_command(MathSqrt),
|
2021-01-01 03:12:16 +01:00
|
|
|
// File format output
|
|
|
|
whole_stream_command(To),
|
2021-03-26 09:26:57 +01:00
|
|
|
whole_stream_command(ToCsv),
|
|
|
|
whole_stream_command(ToHtml),
|
|
|
|
whole_stream_command(ToJson),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(ToMarkdown),
|
2021-03-26 09:26:57 +01:00
|
|
|
whole_stream_command(ToToml),
|
|
|
|
whole_stream_command(ToTsv),
|
|
|
|
whole_stream_command(ToUrl),
|
|
|
|
whole_stream_command(ToYaml),
|
|
|
|
whole_stream_command(ToXml),
|
2021-01-01 03:12:16 +01:00
|
|
|
// File format input
|
|
|
|
whole_stream_command(From),
|
2021-03-26 09:26:57 +01:00
|
|
|
whole_stream_command(FromCsv),
|
|
|
|
whole_stream_command(FromEml),
|
|
|
|
whole_stream_command(FromTsv),
|
|
|
|
whole_stream_command(FromSsv),
|
|
|
|
whole_stream_command(FromIni),
|
|
|
|
whole_stream_command(FromJson),
|
|
|
|
whole_stream_command(FromOds),
|
|
|
|
whole_stream_command(FromToml),
|
|
|
|
whole_stream_command(FromUrl),
|
|
|
|
whole_stream_command(FromXlsx),
|
|
|
|
whole_stream_command(FromXml),
|
|
|
|
whole_stream_command(FromYaml),
|
|
|
|
whole_stream_command(FromYml),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(FromIcs),
|
|
|
|
whole_stream_command(FromVcf),
|
|
|
|
// "Private" commands (not intended to be accessed directly)
|
|
|
|
whole_stream_command(RunExternalCommand { interactive }),
|
|
|
|
// Random value generation
|
|
|
|
whole_stream_command(Random),
|
|
|
|
whole_stream_command(RandomBool),
|
|
|
|
whole_stream_command(RandomDice),
|
|
|
|
#[cfg(feature = "uuid_crate")]
|
|
|
|
whole_stream_command(RandomUUID),
|
|
|
|
whole_stream_command(RandomInteger),
|
|
|
|
whole_stream_command(RandomDecimal),
|
|
|
|
whole_stream_command(RandomChars),
|
|
|
|
// Path
|
|
|
|
whole_stream_command(PathBasename),
|
|
|
|
whole_stream_command(PathCommand),
|
|
|
|
whole_stream_command(PathDirname),
|
|
|
|
whole_stream_command(PathExists),
|
|
|
|
whole_stream_command(PathExpand),
|
2021-03-04 08:04:56 +01:00
|
|
|
whole_stream_command(PathJoin),
|
Path Enhancement Project #2: parse, join and split (#3256)
* Add new path parse subcommand
This includes a slight refactor to all the path subcommand `action()`
functions.
* Remove filestem and extension; Fix example
* Add additional description to path parse
* Put join arg behind flag; Fix missing import (Win)
* Fix error when column path is passed as arg
* Add structured path joining
Structured path is implicitly joined at every patch subcommand call.
* Fix existing path join tests; Fix rustfmt
* Remove redundant 'static lifetime (clippy)
* Add initial impl of path split subcommand
* Add ability to join path from parts
* Fix wrong results in path split examples
* Fix remaining asyncs after engine change
* Do not wrap split path parts into table
When the input is just a list of values, the `path split` command will
split each value directly into the output stream, similar to
`split-row`. Column path--specified values are still wrapped into a
table so they can still be used to replace table fields.
* Join list of values instead of going one-by-one
When `path join` encounters a list of values, it attempts to join them,
instead of going one-by-one like the rest of the path commands. You can
still `each { echo $it | path join }` to join them one-by-one, if the
values are, e.g., tables.
Now, the behavior of `path split` and `path join` should match the
`split-row` and `str collect` counterparts and should hopefully align
better with user's expectations.
* Make sure path join detects structured path
* Fix panic on empty input stream
Also, doesn't collect input into vector unnecessarily.
* Fix path join not appending value
* Remove argument serialization
* Make better errors; Misc refactor
* OsStr -> String encoding is now lossy, instead of throwing an error
* The consequence is action() now always returns Value instead of Result
* Removed redundant handle_value() call in `path join`
* Fix possible incorrect error detection in `path split`
* Applied rustfmt + clippy
* Add more usage, examples & test; Fix type error
The 'parent' column was required to be a path but didn't work with
string.
* Add more help & examples; Maybe fix Windows error
* Refactor operate function
Reducing code repetition
* Review usages and examples
* Add the option to manually specify the extension
* Add more tests; Fix failures on Windows
* Move path commands to engine-p
* Small refactor
2021-04-20 08:45:28 +02:00
|
|
|
whole_stream_command(PathParse),
|
2021-05-22 16:29:40 +02:00
|
|
|
whole_stream_command(PathRelativeTo),
|
Path Enhancement Project #2: parse, join and split (#3256)
* Add new path parse subcommand
This includes a slight refactor to all the path subcommand `action()`
functions.
* Remove filestem and extension; Fix example
* Add additional description to path parse
* Put join arg behind flag; Fix missing import (Win)
* Fix error when column path is passed as arg
* Add structured path joining
Structured path is implicitly joined at every patch subcommand call.
* Fix existing path join tests; Fix rustfmt
* Remove redundant 'static lifetime (clippy)
* Add initial impl of path split subcommand
* Add ability to join path from parts
* Fix wrong results in path split examples
* Fix remaining asyncs after engine change
* Do not wrap split path parts into table
When the input is just a list of values, the `path split` command will
split each value directly into the output stream, similar to
`split-row`. Column path--specified values are still wrapped into a
table so they can still be used to replace table fields.
* Join list of values instead of going one-by-one
When `path join` encounters a list of values, it attempts to join them,
instead of going one-by-one like the rest of the path commands. You can
still `each { echo $it | path join }` to join them one-by-one, if the
values are, e.g., tables.
Now, the behavior of `path split` and `path join` should match the
`split-row` and `str collect` counterparts and should hopefully align
better with user's expectations.
* Make sure path join detects structured path
* Fix panic on empty input stream
Also, doesn't collect input into vector unnecessarily.
* Fix path join not appending value
* Remove argument serialization
* Make better errors; Misc refactor
* OsStr -> String encoding is now lossy, instead of throwing an error
* The consequence is action() now always returns Value instead of Result
* Removed redundant handle_value() call in `path join`
* Fix possible incorrect error detection in `path split`
* Applied rustfmt + clippy
* Add more usage, examples & test; Fix type error
The 'parent' column was required to be a path but didn't work with
string.
* Add more help & examples; Maybe fix Windows error
* Refactor operate function
Reducing code repetition
* Review usages and examples
* Add the option to manually specify the extension
* Add more tests; Fix failures on Windows
* Move path commands to engine-p
* Small refactor
2021-04-20 08:45:28 +02:00
|
|
|
whole_stream_command(PathSplit),
|
2021-01-01 03:12:16 +01:00
|
|
|
whole_stream_command(PathType),
|
|
|
|
// Url
|
|
|
|
whole_stream_command(UrlCommand),
|
|
|
|
whole_stream_command(UrlScheme),
|
|
|
|
whole_stream_command(UrlPath),
|
|
|
|
whole_stream_command(UrlHost),
|
|
|
|
whole_stream_command(UrlQuery),
|
|
|
|
whole_stream_command(Seq),
|
|
|
|
whole_stream_command(SeqDates),
|
2021-02-10 15:58:22 +01:00
|
|
|
whole_stream_command(TermSize),
|
2021-09-01 04:29:09 +02:00
|
|
|
// Network
|
|
|
|
#[cfg(feature = "fetch")]
|
|
|
|
whole_stream_command(Fetch),
|
|
|
|
#[cfg(feature = "post")]
|
|
|
|
whole_stream_command(Post),
|
|
|
|
// System
|
|
|
|
#[cfg(feature = "ps")]
|
|
|
|
whole_stream_command(Ps),
|
|
|
|
#[cfg(feature = "sys")]
|
|
|
|
whole_stream_command(Sys),
|
2021-06-07 19:27:46 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
//Dataframe commands
|
|
|
|
#[cfg(feature = "dataframe")]
|
|
|
|
context.add_commands(vec![
|
2021-05-23 09:37:04 +02:00
|
|
|
whole_stream_command(DataFrame),
|
2021-07-01 06:33:52 +02:00
|
|
|
whole_stream_command(DataFrameOpen),
|
2021-05-23 09:37:04 +02:00
|
|
|
whole_stream_command(DataFrameList),
|
|
|
|
whole_stream_command(DataFrameGroupBy),
|
2021-05-27 07:09:48 +02:00
|
|
|
whole_stream_command(DataFrameAggregate),
|
|
|
|
whole_stream_command(DataFrameShow),
|
|
|
|
whole_stream_command(DataFrameSample),
|
|
|
|
whole_stream_command(DataFrameJoin),
|
|
|
|
whole_stream_command(DataFrameDrop),
|
|
|
|
whole_stream_command(DataFrameSelect),
|
|
|
|
whole_stream_command(DataFrameDTypes),
|
2021-06-03 08:23:14 +02:00
|
|
|
whole_stream_command(DataFrameDummies),
|
2021-07-01 06:33:52 +02:00
|
|
|
whole_stream_command(DataFrameFirst),
|
|
|
|
whole_stream_command(DataFrameLast),
|
2021-06-03 08:23:14 +02:00
|
|
|
whole_stream_command(DataFrameSlice),
|
|
|
|
whole_stream_command(DataFrameMelt),
|
|
|
|
whole_stream_command(DataFramePivot),
|
|
|
|
whole_stream_command(DataFrameWhere),
|
2021-06-07 19:27:46 +02:00
|
|
|
whole_stream_command(DataFrameToDF),
|
2021-06-03 08:23:14 +02:00
|
|
|
whole_stream_command(DataFrameToParquet),
|
|
|
|
whole_stream_command(DataFrameToCsv),
|
2021-06-07 19:27:46 +02:00
|
|
|
whole_stream_command(DataFrameSort),
|
|
|
|
whole_stream_command(DataFrameGet),
|
|
|
|
whole_stream_command(DataFrameDropDuplicates),
|
|
|
|
whole_stream_command(DataFrameDropNulls),
|
|
|
|
whole_stream_command(DataFrameColumn),
|
|
|
|
whole_stream_command(DataFrameWithColumn),
|
2021-06-15 04:34:08 +02:00
|
|
|
whole_stream_command(DataFrameFilter),
|
|
|
|
whole_stream_command(DataFrameSeriesRename),
|
2021-06-20 00:59:39 +02:00
|
|
|
whole_stream_command(DataFrameValueCounts),
|
|
|
|
whole_stream_command(DataFrameIsNull),
|
|
|
|
whole_stream_command(DataFrameIsNotNull),
|
|
|
|
whole_stream_command(DataFrameAllTrue),
|
|
|
|
whole_stream_command(DataFrameAllFalse),
|
|
|
|
whole_stream_command(DataFrameArgMax),
|
|
|
|
whole_stream_command(DataFrameArgMin),
|
|
|
|
whole_stream_command(DataFrameArgTrue),
|
|
|
|
whole_stream_command(DataFrameArgUnique),
|
|
|
|
whole_stream_command(DataFrameArgSort),
|
|
|
|
whole_stream_command(DataFrameUnique),
|
|
|
|
whole_stream_command(DataFrameNUnique),
|
|
|
|
whole_stream_command(DataFrameNNull),
|
|
|
|
whole_stream_command(DataFrameIsUnique),
|
|
|
|
whole_stream_command(DataFrameIsDuplicated),
|
|
|
|
whole_stream_command(DataFrameIsIn),
|
|
|
|
whole_stream_command(DataFrameShift),
|
|
|
|
whole_stream_command(DataFrameSet),
|
2021-07-01 06:33:52 +02:00
|
|
|
whole_stream_command(DataFrameNot),
|
2021-07-05 01:46:53 +02:00
|
|
|
whole_stream_command(DataFrameTake),
|
|
|
|
whole_stream_command(DataFrameSetWithIdx),
|
2021-07-20 14:07:42 +02:00
|
|
|
whole_stream_command(DataFrameShape),
|
2021-07-22 15:45:46 +02:00
|
|
|
whole_stream_command(DataFrameReplace),
|
2021-07-25 12:01:54 +02:00
|
|
|
whole_stream_command(DataFrameReplaceAll),
|
|
|
|
whole_stream_command(DataFrameStringLengths),
|
|
|
|
whole_stream_command(DataFrameContains),
|
|
|
|
whole_stream_command(DataFrameToLowercase),
|
|
|
|
whole_stream_command(DataFrameToUppercase),
|
|
|
|
whole_stream_command(DataFrameStringSlice),
|
|
|
|
whole_stream_command(DataFrameConcatenate),
|
2021-07-25 22:36:09 +02:00
|
|
|
whole_stream_command(DataFrameAppend),
|
2021-08-06 00:18:53 +02:00
|
|
|
whole_stream_command(DataFrameGetHour),
|
|
|
|
whole_stream_command(DataFrameGetMinute),
|
|
|
|
whole_stream_command(DataFrameGetSecond),
|
|
|
|
whole_stream_command(DataFrameGetDay),
|
|
|
|
whole_stream_command(DataFrameGetMonth),
|
|
|
|
whole_stream_command(DataFrameGetYear),
|
|
|
|
whole_stream_command(DataFrameGetWeek),
|
|
|
|
whole_stream_command(DataFrameGetWeekDay),
|
|
|
|
whole_stream_command(DataFrameGetOrdinal),
|
|
|
|
whole_stream_command(DataFrameGetNanoSecond),
|
|
|
|
whole_stream_command(DataFrameStrFTime),
|
2021-08-07 19:48:54 +02:00
|
|
|
whole_stream_command(DataFrameDescribe),
|
2021-08-24 16:10:29 +02:00
|
|
|
whole_stream_command(DataFrameRolling),
|
|
|
|
whole_stream_command(DataFrameCumulative),
|
2021-08-26 15:13:54 +02:00
|
|
|
whole_stream_command(DataFrameRename),
|
2021-01-01 03:12:16 +01:00
|
|
|
]);
|
|
|
|
|
|
|
|
#[cfg(feature = "clipboard-cli")]
|
|
|
|
{
|
2021-06-26 22:42:17 +02:00
|
|
|
context.add_commands(vec![
|
|
|
|
whole_stream_command(crate::commands::Clip),
|
|
|
|
whole_stream_command(crate::commands::Paste),
|
|
|
|
]);
|
2021-01-01 03:12:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(context)
|
|
|
|
}
|