Commit Graph

3147 Commits

Author SHA1 Message Date
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
Darren Schroeder
73f62266c6
allow start to handle urls (#3351) 2021-04-24 09:33:17 -05: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
02d5729941
Properly evaluate dynamic blocks (#3339) 2021-04-21 14:31:54 +12:00
JT
ce35689d2e
Make finding the path variable more robust (#3336)
* Make finding the path variable more robust

* Update reload_config also
2021-04-21 11:37:10 +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
61768aa2fd
Fix parsing dot dot path (#3331) 2021-04-20 08:18:29 +12:00
Darren Schroeder
ea5bf9db36
add query json plugin for experimentation (#3327)
* add query json plugin for experimentation

* add some error handling

* closer but Kind::Array is still horked

* unravel the table so the output looks right

* clippy

* added the ability to use gjson modifiers
2021-04-19 11:19:06 -05: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
Andrés N. Robalino
d34068da18
Implementing Nu command guide. (#3326) 2021-04-16 08:11:26 -05:00
Luccas Mateus
611103d211
Fix Running echo .. starts printing integers forever (#3322) 2021-04-16 07:07:06 +12:00
Darren Schroeder
528c1c5fd8
change $scope.variables output to a table (#3323) 2021-04-15 14:02:08 -05:00
JT
f73732bf1e
Move to* and from* to engine-p (#3320)
* WIP

* Finish last batch
2021-04-15 19:43:33 +12:00
Darren Schroeder
fd7875e572
sort scope.aliases, commands, variables (#3319) 2021-04-14 18:57:47 -05:00
Michael Nitschinger
e8bc319f08
Make sure that scripts can also have custom commands. (#3309)
With the current code it is possible to attach custom commands from
a custom binary, but only for interactive mode. This change makes
it possible to also customize the evaluation context for commands
and scripts.
2021-04-15 06:21:50 +12:00
Martin Mauch
a92ff57270
Use append_history instead of save_history to preserve existing history (#3314) 2021-04-15 06:20:25 +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
Darren Schroeder
a148c640b2
add variables to $scope (#3316) 2021-04-14 09:48:14 -05:00
Darren Schroeder
ea0205f2ff
remote --help/-h from $scope.commands display (#3311)
* remote --help/-h from $scope.commands

* change a test
2021-04-14 07:55:58 -05:00
Darren Schroeder
005649b6fc
remove dupes in get_commands/get_command_names (#3308) 2021-04-13 09:21:44 -05:00
Jonathan Turner
e09e3b01d6
Fix the auto-conversion regression (#3307) 2021-04-13 14:25:18 +12:00
Jonathan Turner
fc15e0e27d
A few optimisations (#3306)
* A few optimisations

* Fix test
2021-04-12 19:47:31 +12:00
Steven Barragán
b2fe5fabb1
Add commands to scope variable (#3272)
* Add commands to scope variable

* List commands with signature on scope variables

Usage:

```shell
echo $scope.commands | pivot
```

* Run rust formater

* Update variables.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2021-04-12 14:38:47 +12:00
Leonhard Kipp
52d69bb021
Fix #3213 Rest arg is not optional (#3303) 2021-04-12 14:37:36 +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
Jakub Žádník
dbecbdccd4
Fix type error when Value is viewed as file path (#3305)
I believe this should be "path", not "string".
2021-04-12 11:53:31 +12:00
Jonathan Turner
734877338d
Remove take_while from internal iterator (#3301) 2021-04-11 18:29: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
ammkrn
b19a7aa8a6
Disallow rm to trash if built without trash-support enabled. (#3278)
If built without `trash_support`, nu should explicitly reject attempts to use `rm` with the `--trash` option, or with a config file which includes `rm_always_trash = true`.

As of 42fac72, there doesn't seem to be any guard in the `#[cfg(not(feature = "trash-support"))]` block of `filesystem_shell::rm`, leading to the behavior described in #3116, where builds without the trash-support feature will delete things permanently regardless of flags/config options.

This should close #3116
2021-04-10 14:01:21 +12: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
Jonathan Turner
41390cd963
Simplify the default feature list (#3288) 2021-04-09 13:39:44 -05:00
Darren Schroeder
0b5e131410
Remove x1b, update prompt (#3291)
* add term size command

* remove \x1b and use nu_ansi_term, make prompt with no config prettier
2021-04-09 11:38:56 -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
Marc Schreiber
111ad868a7
Do not store whitespace entries into history (#3019) (#3286)
Before storing an entry into the history nushell will check if the entry
consists only of whitespaces and if so, it does not store it in the history and
this avoids  newline repetition when user is navigating in the history.
2021-04-09 12:01:31 +12:00
Andrés N. Robalino
a7274115d0
make Table, Autoview read in memory config. (#3287) 2021-04-08 17:31:19 -05:00