nushell/crates/nu-command/tests/commands/mod.rs
Andrés N. Robalino b873fa7a5f
The zip command. (#3919)
We introduce it here and allow it to work with regular lists (tables with no columns) as well as symmetric tables. Say we have two lists and wish to zip them, like so:

```
[0 2 4 6 8] | zip {
  [1 3 5 7 9]
} | flatten

───┬───
 0 │ 0
 1 │ 1
 2 │ 2
 3 │ 3
 4 │ 4
 5 │ 5
 6 │ 6
 7 │ 7
 8 │ 8
 9 │ 9
───┴───
```

In the case for two tables instead:

```
[[symbol]; ['('] ['['] ['{']] | zip {
  [[symbol]; [')'] [']'] ['}']]
} | each {
  get symbol | $'($in.0)nushell($in.1)'
}

───┬───────────
 0 │ (nushell)
 1 │ [nushell]
 2 │ {nushell}
───┴───────────
```
2021-08-14 23:36:08 -05:00

67 lines
746 B
Rust

mod all;
mod any;
mod append;
mod cal;
mod cd;
mod compact;
mod config;
mod cp;
mod def;
mod default;
mod drop;
mod each;
mod echo;
mod empty;
mod enter;
mod every;
mod first;
mod flatten;
mod format;
mod get;
mod group_by;
mod hash_;
mod headers;
mod help;
mod histogram;
mod insert;
mod into_int;
mod keep;
mod last;
mod length;
mod lines;
mod ls;
mod math;
mod merge;
mod mkdir;
mod move_;
mod open;
mod parse;
mod path;
mod pathvar;
mod prepend;
mod random;
mod range;
mod reduce;
mod rename;
mod reverse;
mod rm;
mod roll;
mod rotate;
mod save;
mod select;
mod semicolon;
mod skip;
mod sort_by;
mod split_by;
mod split_column;
mod split_row;
mod str_;
mod touch;
mod uniq;
mod update;
mod where_;
mod which;
mod with_env;
mod wrap;
mod zip;