Commit Graph

7331 Commits

Author SHA1 Message Date
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
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
d34068da18 Implementing Nu command guide. (#3326) 2021-04-16 08:11:26 -05:00
611103d211 Fix Running echo .. starts printing integers forever (#3322) 2021-04-16 07:07:06 +12:00
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
fd7875e572 sort scope.aliases, commands, variables (#3319) 2021-04-14 18:57:47 -05:00
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
a92ff57270 Use append_history instead of save_history to preserve existing history (#3314) 2021-04-15 06:20:25 +12:00
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
a148c640b2 add variables to $scope (#3316) 2021-04-14 09:48:14 -05:00
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
005649b6fc remove dupes in get_commands/get_command_names (#3308) 2021-04-13 09:21:44 -05:00
e09e3b01d6 Fix the auto-conversion regression (#3307) 2021-04-13 14:25:18 +12:00
fc15e0e27d A few optimisations (#3306)
* A few optimisations

* Fix test
2021-04-12 19:47:31 +12:00
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
52d69bb021 Fix #3213 Rest arg is not optional (#3303) 2021-04-12 14:37:36 +12:00
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
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
734877338d Remove take_while from internal iterator (#3301) 2021-04-11 18:29:01 +12:00
2e439ca77f Improve range and internal iteration (#3300) 2021-04-11 13:31:08 +12:00
a853880e07 preparing for into subcommands (#3299) 2021-04-10 11:29:11 -05:00
93f3ed98e1 clean up error handling a bit (#3297)
* clean up error handling a bit

* clippy
2021-04-10 10:10:23 -05:00
a131eddf54 move out call info deserializing from str (#3294) 2021-04-09 22:58:18 -05:00
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
f5aa53c530 Remove length collecting its input (#3292)
* Remove length collecting its input

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

* bug: fix ansi rgb_fg
2021-04-09 15:32:25 -05:00
41390cd963 Simplify the default feature list (#3288) 2021-04-09 13:39:44 -05:00
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
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
b791d1ab0d Move from using a Block to an Arc'd Block (#3289) 2021-04-09 20:12:25 +12:00
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
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
a7274115d0 make Table, Autoview read in memory config. (#3287) 2021-04-08 17:31:19 -05:00
81160bcefb Remove some clones and improve when autoview reads config (#3285) 2021-04-09 07:47:41 +12:00
2880109f31 Runnable contexts move. (#3283)
* Engine extract first steps.

* Don't depend on ShellManager.
2021-04-08 13:51:12 -05:00
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
5fcf11fcb0 Fix externals busy waiting (#3280) 2021-04-08 07:25:15 +12:00
42fac722bb Bump to 0.29.2 (#3274)
* Bump to 0.29.2

* Fix test
2021-04-07 08:14:06 +12:00
073e5727c6 Switch to "engine-p" (#3270)
* WIP

* WIP

* first builds

* Tests pass
2021-04-06 11:19:43 -05:00
ad1c4f5e39 [fix] crashing issues when the given timestamp is out of range (#3271)
* add support for timestamp-based time conversion by specifing timezone or 'UTC/Local'

* [fix] fix the wrong test sample

* code formating

* code formating and import missing mod to test

* code formating again

* [fix] it won't crash when given timestamp is too big.

* [fix] code formatting =_=b
2021-04-06 07:22:07 -05:00
dc8a68c98f Bump sysinfo (#3267)
* add term size command

* update to the latest sysinfo
2021-04-05 14:36:19 -05:00
e5621dea58 Remove yr and mon (#3262)
* Remove `yr` and `mon`

* Remove usage of mon in test

* Fix test
2021-04-05 06:19:33 +12:00
00acf22f5f account for startup commands in the scope. (#3261)
* Revert "Impl one configurable function to run scripts (#3242)"
* pass config startup.
2021-04-04 00:14:58 -05:00
4c09716ad8 add TiB and PiB (#3257) 2021-04-04 12:08:17 +12:00
1c941557c3 Remove unused help shell. Slight cleanup and improvement. (#3258) 2021-04-03 18:56:46 -05:00
28e1a7915d Impl one configurable function to run scripts (#3242)
* Impl one func to run scripts

* Add exit_on_err

* Remove run_standalone

* Make the compiler happy :)
2021-04-04 07:31:53 +12:00
4bc9d9fd3b Fix typos and capitalization of "Unicode" (#3234)
* Capitalize "Unicode"

* Fix several typos

* Fix mixed whitespace in nu-parser's tests
2021-04-04 07:14:07 +12:00
e278ca61d1 commands: any? all? (#3252)
* commands: any? all?

We can check if `any` (or `all`) rows of tables match predicates.

Small `all?` example: Given the following table with `services` running:

```
> echo [[status]; [UP] [UP]]
───┬────────
 # │ status
───┼────────
 0 │ UP
 1 │ UP
───┴────────
```

We can ask if all services are UP, like so:

```
> echo [[status]; [UP] [UP]] | all? status == UP
true
```

* Fix any? signature.
2021-04-03 13:40:54 -05:00
2146ede15d Parse decimal units (#3243)
* parse decimal units

* linting

* stop clippy complaining

* Added tests to parsing decimals

* Fixed bug

* Fixed testing and add more
2021-04-03 21:06:13 +13:00