Commit Graph

242 Commits

Author SHA1 Message Date
JT
7d78f40bf6
Bump to 0.32.1 (#3553) 2021-06-04 19:07:50 +12:00
JT
131b5b56d7
Finish removing arg deserialization (#3552)
* WIP remove process

* WIP

* WIP

* Finish removing arg deserialization
2021-06-04 18:23:57 +12:00
Darren Schroeder
13257004bc
add list of installed plugins to version command (#3548) 2021-06-03 08:53:32 -05:00
Fernando Herrera
5537dce3cc
Dataframe commands (#3502)
* Sample command

* Join command with checks

* More dataframes commands

* Groupby and aggregate commands

* Missing feature dataframe flag

* Renamed file

* New commands for dataframes

* error parser and df reference

* filter command for dataframes

* removed name from nu_dataframe

* commands to save to parquet and csv
2021-06-03 18:23:14 +12:00
JT
df526f73be
Bump to 0.32 (#3521)
* Bump to 0.32

* Bump to 0.32
2021-06-01 08:14:50 +12:00
Christian Menges
29a77fd6ae
Bump rusqlite from 0.24.2 to 0.25.3 (#3523) 2021-06-01 07:34:51 +12:00
Lily Mara
4b11b283ac
Resolve issues with rm * globbing (#3516)
Using the `*` wildcard should not attempt to delete files with a leading dot
unless the more explicit `.*` is used. `rm *` should also not attempt to delete
the current directory or its parent directory (`.` and `..`). I have resolved
this bug as well in a less satisfactory way. I think it may be the case that we
can only disambiguate the `.` and `..` path segments by using `Path::display`.
Here is a short list of alternatives that I tried:

- `Path::ends_with()` can detect `/..` but not `/.`.
- `Path::iter()` and `Path::components()` leave out `/.`.
- `Path::file_name()` normalizes `/.` to the parent component's file name.

Fixes #3508
2021-05-30 15:36:36 +12:00
JT
55baee9a9a
Cleanup let varname and rhs (#3507) 2021-05-28 19:48:54 +12:00
JT
0886afe650
Fix for in (#3506)
* Fix for..in examples

* Fix for..in examples
2021-05-28 11:20:33 +12:00
JT
872f6166e1
Add for..in command (#3504) 2021-05-28 10:32:45 +12:00
Jakub Žádník
fe348e236f
Convert do command to engine-p; Fix flag name (#3503)
Renamed "ignore_errors" to "ignore-errors" to be aligned with nushell's
naming conventions.
2021-05-28 10:12:52 +12:00
Darren Schroeder
48171f8e24
remove str from (#3500) 2021-05-27 12:18:02 -05:00
Darren Schroeder
bcdf74562b
remove into int references (#3499) 2021-05-27 11:35:25 -05:00
Fernando Herrera
3a5ee1aed0
Dataframe commands (#3498)
* Sample command

* Join command with checks

* More dataframes commands

* Groupby and aggregate commands

* Missing feature dataframe flag

* Renamed file
2021-05-27 17:09:48 +12:00
Lily Mara
1ee51f2afa
Add the load-env command (#3484)
* Add the load-env command

load-env can be used to add environment variables dynamically via an
InputStream. This allows developers to create tools that output environment
variables as key-value pairs, then have the user load those variables in using
load-env. This supplants most of the need for an `eval` command, which is
mostly used in POSIX envs for setting env vars.

Fixes #3481

* fixup! Add the load-env command
2021-05-26 06:18:20 +12:00
Darren Schroeder
65ee7aa372
correctly escape pipe in windows/cmd.exe (#3489)
* correctly escape pipe in windows/cmd.exe

* add some comments, take out debug line
2021-05-25 09:19:45 -05:00
Darren Schroeder
ac38ee82f4
error message cleanup for into string (#3488) 2021-05-25 07:49:12 -05:00
Tomas Koutsky
6165b6ae77
Add params to do (#3477) 2021-05-24 09:21:41 +12:00
Fernando Herrera
e335e4fddc
Groupby operations on dataframes (#3473)
* Added PolarsStruct enum to implement groupby

* template groupby

* groupby operationi on dataframes
2021-05-23 19:37:04 +12:00
Jakub Žádník
5ab4199d71
Add path separator to char; Update char to engine-p; List all names of all possible chars (#3470)
* Allow querying the current path separator

* Convert char command to engine-p

* Wrap char args into struct

* Add --list option to char command

This lists all the available character names, along with the character
and its unicode points.
2021-05-22 11:48:33 -05:00
Fernando Herrera
f075e2459d
Commands to engine (#3448)
* commands to engine

* Correction of error in parser

* Added detailed regex error to parse

* better regex error parsing

* clippy corrections

* parse example with test

* secondary error for regex

* removed clone in error parser

* Secondary error message
2021-05-22 10:52:04 -05:00
Jakub Žádník
94a26abf21
Implement path relative-to subcommand (#3461)
* Register new path relative-to command

* Implement `path relative-to` subcommand
2021-05-22 09:29:40 -05:00
Leonhard Kipp
bcbdc33049
Use enginep style in enter command (#3469) 2021-05-22 09:27:42 -05:00
Henrik Sjööh
21ef3895b3
delete crates/nu-command/src/commands/date/utc.rs (#3464)
The `date utc` command was removed in this PR:

https://github.com/nushell/nushell/pull/2780

The file was left but is no longer referenced from the parent module
and was not used.

Co-authored-by: Henrik Sjööh <henrik.sjooh@configura.com>
2021-05-22 17:09:50 +12:00
JT
3e99dc01b0
let date commands pull default date (#3463) 2021-05-22 17:02:06 +12:00
Eli Flanagan
2b92e3e8a7
port group-by to engine-p (#3458)
* migrate group-by to engine p

Part of #3390.

* consume positional argument correctly
2021-05-21 21:19:43 -05:00
Darren Schroeder
cb90b90cbf
nothing converted to string should return nothing and not fail (#3459) 2021-05-21 11:06:53 -05:00
Darren Schroeder
9776a252ee
add addition characters that can be hard to work with in nushell (#3457) 2021-05-21 08:04:48 -05:00
JT
751de20f93
Do a bit more cleanup of block params (#3455)
* Do a bit more cleanup of block params

* Do a bit more cleanup of block params
2021-05-21 19:04:27 +12:00
JT
28388b4e3a
Split unit into duration and filesize (#3453) 2021-05-21 13:21:46 +12:00
JT
4fdbf30308
Paren interpolation (#3452)
* Switch interp to use parens

* improve interp parsing
2021-05-21 10:55:38 +12:00
Darren Schroeder
722f191e82
updated round to support i64 (#3451) 2021-05-20 13:59:19 -05:00
JT
20f6114617
Improve block params (#3450) 2021-05-20 16:26:54 +12:00
Jakub Žádník
3075e2cfbf
Remove rest_args() from evaluated CommandArgs (#3449)
It was too error prone when positional arguments were used with the rest
arguments. Now, you need to explicitly state from which position you
want to count the rest args (e.g., `rest(0)`).
2021-05-20 10:26:23 +12:00
JT
e2973d2176
Add explicit block params (#3444)
* Add explicit block params

* Add explicit block params
2021-05-19 20:23:45 +12:00
Jakub Žádník
08c0bf52bc
Fix path join argument type and a typo (#3441) 2021-05-19 09:30:37 +12:00
Fernando Herrera
d0229cb96e
Load parquet and json files (#3437)
* Load parquet and json files

* changed csv file error
2021-05-19 07:33:10 +12:00
Darren Schroeder
0612e5ccfb
updated to the latest rustyline (#3439) 2021-05-18 12:36:55 -05:00
Darren Schroeder
1b4f7b34c8
don't let externals break ansi escapes (#3438) 2021-05-17 18:01:34 -05:00
Alex Shadley
86e6fcd309
Negative indexing for range (#3427)
* adds negative indexing to range

* fixes tests to reflect new parsing changes

* removes duplicate definitons

* fmt
2021-05-17 15:08:47 +12:00
Marc Schreiber
dc9cd7d8b9
Add Support for Partial Completions (#3432)
This commit adds a conditional event handler that inserts the next word of the
hint text when the user presses control and right arrow.
2021-05-16 08:43:43 +12:00
Fernando Herrera
c0cc9ce7cd
Dataframe new commands (#3425)
* Folder for dataframe commands

* New commands for dataframe
2021-05-15 19:24:11 +12:00
Fernando Herrera
07760b4129
Commands to engine p (#3426)
* hash and into converted

* keep command to engine p

* Update int.rs

Co-authored-by: JT <jonathandturner@users.noreply.github.com>
2021-05-15 16:11:07 +12:00
JT
d79a3130b8
Make the default int an i64 (#3428)
* Make the default int an i64

* fmt

* Fix random integer

* Treat pids as i64 for now
2021-05-14 20:35:09 +12:00
JT
9b8b1bad57
Don't insert PATH variable on Windows (#3422)
* Don't insert PATH variable on Windows

* Simplify fix

* Just centralize the var

* Add a message about why we have to workaround the issue
2021-05-13 15:03:49 +12:00
Fernando Herrera
0905a2c3a2
commands to engine p (#3417)
* commands to engine p

* Clippy suggestion

* Clippy suggestion
2021-05-13 07:07:20 +12:00
JT
2bb23c57df
Bump to 0.31.1 (#3411) 2021-05-12 15:06:50 +12:00
Fernando Herrera
bc699a2cc1
date commands ported (#3410) 2021-05-12 14:01:49 +12:00
Fernando Herrera
758c128147
Config commands to engine p (#3408)
* config get command

* config remove command

* config set command

* config command

* config commands
2021-05-12 14:01:16 +12:00
Alex Shadley
3795c2a39d
Migrate last to engine-p (#3406)
* migrates last to engine-p

* removes unused import

* linter fix

* switch to as_usize()
2021-05-12 13:59:08 +12:00
JT
311c0e3f50
Simplify string interpolation (#3401)
* [DRAFT] simplify string interpolation

* Fix test
2021-05-12 13:53:57 +12:00
JT
25a8caa9b0
Simplify expressions (#3389)
* WIP: experiment with simpler expressions

* fix simple invoke

* update tests

* fix a few tests

* Make paren parsing more robust

* fix external args

* Remove old invocation

* Update tests

* Update tests
2021-05-12 13:01:48 +12:00
Fernando Herrera
c80a9585b0
Complete Dataframe MVP (#3373)
* Dataframe MVP

* Removed test csv file

* Dataframe MVP

* Removed test csv file

* New revision polars

* New revision polars

* csv file reader

* argument parser for file reader

* Parser from Row primitive

* Column conversion

* Added as f32 and f64

* Parsing row to dataframe

* Removed repeated push to vector

* Accept table values to create dataframe

* Removed default serde

* Dataframe to rows to show data

* Save name of file with dataframe

* Usage example

* Upgrade polars version

* Clippy changes

* Added print function with head and tail

* Move dataframe struct to folder

* Lock file after running tests and merge

* Optional feature for dataframe

* Removed dataframe from plugins

* Update primitive.rs

Co-authored-by: JT <jonathandturner@users.noreply.github.com>
2021-05-12 13:01:31 +12:00
Darren Schroeder
e73491441a
make seq more nu-like by returning numbers when possible (#3409) 2021-05-11 12:02:16 -05:00
JT
48128c9db6
Bump to 0.31.0 (#3405) 2021-05-11 16:44:52 +12:00
Fernando Herrera
6dafaa197d
Commands to engine p (#3404)
* Change ansi command

* Change ansi strip command

* Change benchmark to engine-p

* ansi strip removed arg.process()

* benchmark without process args
2021-05-11 16:03:55 +12:00
Darren Schroeder
1634d8e087
add into string (#3403) 2021-05-10 12:58:51 -05:00
Jakub Žádník
7a583083b8
Convert the rest of "random" subcommands to engine-p (#3399)
* Convert "random bool" to engine-p

Also implements FromValue for Tagged<BigDecimal> and Tagged<f64>.

* Convert "random dice" to engine-p

* Convert "random uuid" to engine-p

* Covert "random chars" to engine-p

* Convert "random" command to engine-p
2021-05-10 19:07:57 +12:00
Michael Angerman
75156ab0c9
engine-p: build-string remove ActionStream (#3394) 2021-05-08 16:59:12 +12:00
Jakub Žádník
9fd6923821
Port random integer & decimal to engine-p + related refactoring (#3393)
* Implement minmax for Range; Simplify range command

* Port random integer to enginep; New FromValue impl

Now, FromValue is implemented for Tagged<Range> to allow extracting args
into this type.

* Make sure range value extraction fails properly

The range endpoint extraction methods now return error instead of
silently clipping the value. This now makes `random integer ..-4` fail
properly since -4 can't be cast as u64.

* Port random decimal to enginep & Refactor

This added a way to interpret Range limits as f64 and a Primitive helper
to get its value as f64.

A side effect of this commit is that it is now possible to specify the
command bounds as true decimals. E.g., `random decimal 0.0..3.14` does
not clip 3.14 to 3.
2021-05-08 07:58:12 +12:00
JT
91a929b2a9
Clippy fixes for new Rust version (#3392) 2021-05-07 07:58:21 +12:00
Javier Goday
bd71c2f34d
#3385: Add ignore-case and duplicated options to uniq command (#3387)
* #3385: Add ignore-case and duplicated options to uniq command

* rustfmt
2021-05-06 12:07:42 +12:00
JT
fc59291191
Simplify down to one type of context (#3379)
* Simplify down to one type of context

* More simplification
2021-05-03 11:45:55 +12:00
Jakub Žádník
4fc05cac56
Port range to engine-p (#3377)
* Removes arg serialization
* action stream -> output stream
* uses nu_protocol::Range instead of NumericRange
* random missing newline I found in the code
2021-05-03 07:47:59 +12:00
Darren Schroeder
cc4616f25b
added check for endian-ness, added a bytes and skip (#3375) 2021-05-01 15:48:17 -05:00
Darren Schroeder
e82fbb7bcf
added ability to change "#" color using header_color (#3374) 2021-05-01 12:30:50 -05:00
Darren Schroeder
8cd639f6a2
add nu-pretty-hex, add into binary, update binaryview (#3370)
* add nu-pretty-hex, add into binary, update binaryview

* updated parameter name, updated examples

* fixed nu-pretty-hex test

* fixed tests again! and added a no color option to pretty-hex
2021-05-01 11:12:25 -05:00
Darren Schroeder
a8f555856a
tweaked the error handling to show specific errors (#3367) 2021-04-30 09:24:06 -05:00
Javier Goday
f9f74a0f7d
#3298: reduce --numbered bug (#3354) 2021-04-27 19:07:56 +12:00
Jakub Žádník
77f42931ff
Fix table-pager feature compilation (#3359)
It compiles and works without errors, but the pager is not asynchronous
anymore (i.e., you need to wait for `seq 1 1000000` to finish before the
pager is displayed).
2021-04-27 19:06:57 +12:00
ccde177b5fb9b8c55078417b4c9fee
df2f3d25b0
ichwh removed (#3349)
* ichwh removed

* removed unnecessary into() on PathBuf
2021-04-23 05:14:20 +12:00
JT
599c43ce04
bump to 0.30.1 (#3348) 2021-04-22 21:07:54 +12:00
Leonhard Kipp
5c2199e7f4
Move any to enginep style (#3324) 2021-04-22 20:35:45 +12:00
JT
3ad4e0348f
Fix external redirect (#3345)
* Fix external redirection

* Fix external redirection
2021-04-22 08:54:34 +12:00
JT
da81e21bf2
Add a sync from the known path to the env (#3335) 2021-04-21 08:22:53 +12:00
Jakub Žádník
3b2ed7631f
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 18:45:28 +12:00
Leonhard Kipp
1a46e70dfb
Use new functions in which (#3310)
* Use new functions in which

* Impl rest_with_minimum and use it

* Use has_flag instead of get_switch
2021-04-20 18:38:36 +12:00
JT
0fc9b6cfa2
Bump to 0.30 (#3333)
* Bump to 0.30

* fix test
2021-04-20 18:34:10 +12:00
JT
9d24afcfe3
Make nth more stream-able (#3330) 2021-04-19 19:45:12 +12:00
Leonhard Kipp
033df9457b
Engine-p style in compact (#3325)
* Engine-p style in compact

* Remove unused import

* Use filter in compact, thanks to clippy for spotting it :]
2021-04-19 06:40:29 +12:00
Leonhard Kipp
d8e105fe34
Enginep/all (#3312)
* Add iter-extensions

* Move all to enginep style

* Remove iter extensions

* Fix clippy lints

* Add comment and make ? more visible

* Remove try_all

* Remove all because it cant return err
2021-04-19 06:39:33 +12:00
JT
f73732bf1e
Move to* and from* to engine-p (#3320)
* WIP

* Finish last batch
2021-04-15 19:43:33 +12:00
Luccas Mateus
004230d02d
Deserialization and outputstream math commands (#3315)
* Output error when ls into a file without permission

* math sqrt

* added test to check fails when ls into prohibited dir

* fix lint

* math sqrt with tests and doc

* trigger wasm build

* Update filesystem_shell.rs

* converted math commands to outputstream and new method for arg evaluation

* fmt

* clippy

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2021-04-15 06:18:37 +12:00
Jonathan Turner
fc15e0e27d
A few optimisations (#3306)
* A few optimisations

* Fix test
2021-04-12 19:47:31 +12:00
Jonathan Turner
5f550a355b
Split OutputStream into ActionStream/OutputStream (#3304)
* Split OutputStream into ActionStream/OutputStream

* Fmt

* Missed update

* Cleanup helper names

* Fmt
2021-04-12 14:35:01 +12:00
Jonathan Turner
2e439ca77f
Improve range and internal iteration (#3300) 2021-04-11 13:31:08 +12:00
Darren Schroeder
a853880e07
preparing for into subcommands (#3299) 2021-04-10 11:29:11 -05:00
Darren Schroeder
93f3ed98e1
clean up error handling a bit (#3297)
* clean up error handling a bit

* clippy
2021-04-10 10:10:23 -05:00
Andrés N. Robalino
a131eddf54
move out call info deserializing from str (#3294) 2021-04-09 22:58:18 -05:00
Jonathan Turner
f5aa53c530
Remove length collecting its input (#3292)
* Remove length collecting its input

* Update length.rs
2021-04-10 10:21:51 +12:00
Darren Schroeder
80f5e14512
Fix ansi rgb fg (#3293)
* add term size command

* bug: fix ansi rgb_fg
2021-04-09 15:32:25 -05:00
Eli Flanagan
556596bce8
add "into int" behavior (#3279)
* add 'int' command

* create `into int` behavior

- forcibly overwrote prior implementation

```sh
git mv -f  crates/nu-command/src/commands/int_.rs crates/nu-command/src/commands/into_int.rs
```
- picked up prior work, polished and renamed

Co-authored-by: Saeed Rasooli <saeed.gnu@gmail.com>
2021-04-09 09:17:39 -05:00
Jonathan Turner
b791d1ab0d
Move from using a Block to an Arc'd Block (#3289) 2021-04-09 20:12:25 +12:00
Leonhard Kipp
ac070ae942
Refactor/config commands (#3265)
* Use ctx.configs in all config commands

* Remove all setting/accessing of  vars.("config-path")

* Add tests

* Add comment

* Reload cfg on remove

* Hypocratic ws change

* Use history_path in hist_or_default

* Make clippy happy

* Fix rebase stuff

* Fix clippy lint
2021-04-09 18:03:12 +12:00
Andrés N. Robalino
a7274115d0
make Table, Autoview read in memory config. (#3287) 2021-04-08 17:31:19 -05:00
Jonathan Turner
81160bcefb
Remove some clones and improve when autoview reads config (#3285) 2021-04-09 07:47:41 +12:00
Andrés N. Robalino
2880109f31
Runnable contexts move. (#3283)
* Engine extract first steps.

* Don't depend on ShellManager.
2021-04-08 13:51:12 -05:00
Jonathan Turner
09a1f5acb9
Begin migration away from arg serialization (#3281)
* initial implementation

* Move a few commands over to new arg system

* Fix char also
2021-04-08 20:15:36 +12:00
Jonathan Turner
5fcf11fcb0
Fix externals busy waiting (#3280) 2021-04-08 07:25:15 +12:00
Jonathan Turner
42fac722bb
Bump to 0.29.2 (#3274)
* Bump to 0.29.2

* Fix test
2021-04-07 08:14:06 +12:00