2021-04-03 20:40:54 +02:00
|
|
|
mod all;
|
|
|
|
mod any;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod append;
|
2020-05-10 01:05:48 +02:00
|
|
|
mod cal;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod cd;
|
|
|
|
mod compact;
|
|
|
|
mod cp;
|
2021-01-07 18:14:51 +01:00
|
|
|
mod def;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod default;
|
2020-04-26 08:34:45 +02:00
|
|
|
mod drop;
|
2020-04-13 09:59:57 +02:00
|
|
|
mod each;
|
2020-07-06 10:23:27 +02:00
|
|
|
mod echo;
|
2020-10-06 12:21:20 +02:00
|
|
|
mod empty;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod enter;
|
2020-06-16 21:58:41 +02:00
|
|
|
mod every;
|
2021-08-27 10:48:41 +02:00
|
|
|
mod find;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod first;
|
2020-10-14 11:36:11 +02:00
|
|
|
mod flatten;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod format;
|
|
|
|
mod get;
|
|
|
|
mod group_by;
|
2020-11-30 18:47:35 +01:00
|
|
|
mod hash_;
|
2020-03-29 04:05:57 +02:00
|
|
|
mod headers;
|
2021-02-26 21:05:22 +01:00
|
|
|
mod help;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod histogram;
|
2021-09-03 01:19:54 +02:00
|
|
|
mod into_filesize;
|
2020-08-27 07:44:18 +02:00
|
|
|
mod into_int;
|
2020-04-30 06:18:24 +02:00
|
|
|
mod keep;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod last;
|
2021-03-13 22:46:40 +01:00
|
|
|
mod length;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod lines;
|
|
|
|
mod ls;
|
2020-04-18 03:50:58 +02:00
|
|
|
mod math;
|
2020-04-30 06:18:24 +02:00
|
|
|
mod merge;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod mkdir;
|
2020-07-06 17:27:01 +02:00
|
|
|
mod move_;
|
2022-02-04 03:01:45 +01:00
|
|
|
mod open;
|
|
|
|
mod parse;
|
|
|
|
mod path;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod prepend;
|
2020-06-25 07:51:09 +02:00
|
|
|
mod random;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod range;
|
2020-08-04 19:16:19 +02:00
|
|
|
mod reduce;
|
2022-02-08 21:57:46 +01:00
|
|
|
mod reject;
|
2020-03-03 22:01:24 +01:00
|
|
|
mod rename;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod reverse;
|
|
|
|
mod rm;
|
2021-02-23 19:29:07 +01:00
|
|
|
mod roll;
|
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
|
|
|
mod rotate;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod save;
|
2020-05-07 13:03:43 +02:00
|
|
|
mod select;
|
2020-04-20 08:41:51 +02:00
|
|
|
mod semicolon;
|
2020-07-15 03:44:49 +02:00
|
|
|
mod skip;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod sort_by;
|
2021-08-19 09:06:18 +02:00
|
|
|
mod source;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod split_by;
|
|
|
|
mod split_column;
|
2020-05-24 08:41:30 +02:00
|
|
|
mod split_row;
|
2020-05-27 00:19:18 +02:00
|
|
|
mod str_;
|
2020-02-18 21:54:32 +01:00
|
|
|
mod touch;
|
2019-12-31 05:05:02 +01:00
|
|
|
mod uniq;
|
2020-05-07 07:33:30 +02:00
|
|
|
mod update;
|
2022-02-18 02:58:24 +01:00
|
|
|
mod use_;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod where_;
|
2022-02-12 21:48:17 +01:00
|
|
|
#[cfg(feature = "which")]
|
2021-01-08 18:44:31 +01:00
|
|
|
mod which;
|
2020-05-06 05:56:31 +02:00
|
|
|
mod with_env;
|
2019-12-15 17:15:06 +01:00
|
|
|
mod wrap;
|
2021-08-15 06:36:08 +02:00
|
|
|
mod zip;
|