Commit Graph

10224 Commits

Author SHA1 Message Date
7636cc7fe4 avoid test failure caused by locale thousand separator (#7142)
Co-authored-by: Ricardo Monteiro <ricardo.monteiro@getmanta.com>
2022-11-16 11:15:15 +13:00
f856e64fb3 to html --list now returns a table (#7080)
* `to html --list` now returns a table

* Re-add screenshots link
2022-11-15 11:12:56 -06:00
a783a084d4 Update PR template; Add some tests instructions (#7135) 2022-11-15 00:43:15 +01:00
81b12d02ec Change parser cwd when running a file (#7134)
* Change parser cwd when running a file

* Add test

* Add missing file
2022-11-15 00:05:27 +01:00
336df6c65e Return errors on unexpected inputs to take and first (#7123)
* Fix `take` behaviour for unexpected input types

* Fix `first` behaviour for unexpected input types

* Fix copy paste mistake
2022-11-13 15:15:27 -08:00
35f9299fc6 fix ansi --osc parameter adding extra semi-colon (#7113) 2022-11-12 23:27:58 +01:00
649c8319e6 Add input-output types to $nu.scope.commands (#7105)
* Add input and output types to $nu.scope.commands

This commit changes the schema: instead of

command.signature: table

we now have

command.signatures: list<table>

with one signature for every input-output type pair.

* Represent signatures as a map from input_type to signature

* Sort signature entries

* Drop command name from signature tables

* Don't use "rest" as name of rest parameter; use empty string instead

* Bug fix: was creating records with repeated keys

E.g.
$nu.scope.commands | where name == 'hash sha256' | get signatures.0 | table -e
$nu.scope.commands | where name == 'transpose' | get signatures.0 | table -e
2022-11-12 14:26:20 -08:00
99cf5871aa Try --locked install in virtualenv CI tests (#7117)
Currently we see CI failures due to a `chrono` upgrade with
deprecations.
Also on every new reedline release we also suffer from regular compile
problems.
2022-11-12 18:53:57 +01:00
da04e9d801 Remove accidental strip-ansi-escapes after #6938 (#7115) 2022-11-12 17:12:40 +01:00
2db2d98ef0 Add missing dependency to Cargo.lock (#7114) 2022-11-12 16:13:42 +01:00
817eacccd8 removes unused features. (#6938)
* removes unused features.

* Adds back multithreading feature to sysinfo.

* Adds back alloc for percent-encoding

* Adds updated lock file.

* Missed one sysinfo.

* `indexmap` just defaults

* Revert `miette``default-features=false`

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
2022-11-12 18:44:56 +13:00
ce6d3c6eb2 Refactor creation of $nu.scope in eval.rs (#7104)
The function was ~400 lines long and hence very hard to work with.
2022-11-11 23:20:28 +01:00
ef32e1ce1a reset stack size to 10mb vs 2gb (#7103) 2022-11-11 15:22:26 -06:00
JT
c1105e945e Add additional assignment operators (#7102) 2022-11-12 07:50:43 +13:00
JT
69b089845c Add support for while loops (#7101) 2022-11-12 07:21:45 +13:00
75556f6c5f fix(#7097): let-env should not be able to set PWD (#7100) 2022-11-12 05:45:51 +13:00
b650d1ef79 Remove --separator from seq date (#7096) 2022-11-11 20:16:44 +13:00
JT
099b571e8f All field assignment into the env variable (#7099) 2022-11-11 20:16:07 +13:00
cb926f7b49 Better error message when rm can't find files (#7098) 2022-11-10 23:05:09 -08:00
JT
13515c5eb0 Limited mutable variables (#7089)
This adds support for (limited) mutable variables. Mutable variables are created with mut much the same way immutable variables are made with let.

Mutable variables allow mutation via the assignment operator (=).

❯ mut x = 100
❯ $x = 200
❯ print $x
200

Mutable variables are limited in that they're only tended to be used in the local code block. Trying to capture a local variable will result in an error:

❯ mut x = 123; {|| $x }
Error: nu::parser::expected_keyword (link)

  × Capture of mutable variable.

The intent of this limitation is to reduce some of the issues with mutable variables in general: namely they make code that's harder to reason about. By reducing the scope that a mutable variable can be used it, we can help create local reasoning about them.

Mutation can occur with fields as well, as in this case:

❯ mut y = {abc: 123}
❯ $y.abc = 456
❯ $y

On a historical note: mutable variables are something that we resisted for quite a long time, leaning as much as we could on the functional style of pipelines and dataflow. That said, we've watched folks struggle to work with reduce as an approximation for patterns that would be trivial to express with local mutation. With that in mind, we're leaning towards the happy path.
2022-11-11 19:51:08 +13:00
JT
58d960d914 Update README re: typechecking (#7094) 2022-11-11 15:16:10 +13:00
JT
4a83bb6c93 Fix environment conversions (#7092) 2022-11-11 13:13:07 +13:00
3e56e81d06 fix plugin detection in help commands (#7088) 2022-11-10 16:12:09 -06:00
312e9bf5d6 fix overflow on negative bytes (#7070) 2022-11-10 22:33:15 +01:00
JT
18d7e64660 Convert 'for' to a statement (#7086) 2022-11-11 09:05:34 +13:00
f1118020a1 add commented out mold linker usage (#7081) 2022-11-10 08:41:06 -06:00
JT
63433f1bc8 Split blocks and closures (#7075)
* Split closures and blocks

* Tests mostly working

* finish last fixes, passes all tests

* fmt
2022-11-10 21:21:49 +13:00
921a66554e Replace all instances of 'column path' in help messages with 'cell path' (#7063)
* Rewrite all 'column path' instances to 'cell path'

* Minor tweak
2022-11-09 21:49:11 -08:00
bb0d08a721 Fix command_type classification (#7074)
- Custom commands are true for builtin and custom
- Add classification as external command
- Specify wildcard in keyword: keyword is true for builtin and keyword
2022-11-09 19:09:33 -08:00
fe14e52e77 Collapse some help commands columns into a single column (#7052) 2022-11-09 17:44:32 -08:00
24d72ca43c Simplify seq char (#7054)
* Simplify `seq char`

* Fix input/output tests
2022-11-09 17:06:47 -08:00
457f7889df use path.try_exist() to fix silent errors (#7069) 2022-11-09 16:54:43 -08:00
7b0c0692dc Type validation for headers command (#6918) (#7047)
cargo clippy lints

tests

format

Co-authored-by: Ricardo Monteiro <ricardo.monteiro@getmanta.com>
2022-11-09 16:43:24 -08:00
c4cb3a77cb command open returns error when does not have parameters (#7048) (#7058)
test

Co-authored-by: Ricardo Monteiro <ricardo.monteiro@getmanta.com>
2022-11-10 00:25:32 +01:00
aed8d3800b Fix CI failures after PR merge conflicts (#7072) 2022-11-10 00:24:57 +01:00
53a9264b67 return value::int instead of value::record in history session (#7049)
* return value::int instead of value::record

* clippy
2022-11-10 11:20:52 +13:00
e18fb13616 Make seq output type consistent (#7045) 2022-11-10 11:19:02 +13:00
2201bd9b09 Require column name(s) in sort-by (#7041) 2022-11-10 11:16:51 +13:00
da8f6c5682 Require input for date format (#7043) 2022-11-10 11:16:14 +13:00
14d7ba5cc9 Remove --predicate flag from find (#7042) 2022-11-10 11:15:17 +13:00
5ee096232c Remove sqlparser SQLite commands (#7040) 2022-11-10 11:14:48 +13:00
c259ef41bd update polar to 0.25 (#6988) 2022-11-10 11:07:38 +13:00
2c238aea6a Fixed $in in where blocks (#6976) 2022-11-10 11:05:15 +13:00
c600c1ebe7 Fix ignore-errors for select (#6896)
* Fix ignore-errors for select

* fix Value::List match

* fix invalid rows

* add tests

* fix ListStream match

* add one more test for ListStream

* add more tests

* tweak words
2022-11-10 10:57:44 +13:00
df94052180 Declare input and output types of commands (#6796)
* Add failing test that list of ints and floats is List<Number>

* Start defining subtype relation

* Make it possible to declare input and output types for commands

- Enforce them in tests

* Declare input and output types of commands

* Add formatted signatures to `help commands` table

* Revert SyntaxShape::Table -> Type::Table change

* Revert unnecessary derive(Hash) on SyntaxShape

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
2022-11-10 10:55:05 +13:00
JT
f878276de7 Turn off foreground processes on macOS (#7068)
* Turn off foreground processes on macOS

* fmt
2022-11-10 07:39:09 +13:00
cd89304706 Add help warnings for path exists and path type regarding usage (#7062)
* Add help warnings to `path exists` and `path type`

* Correction
2022-11-09 13:41:55 +01:00
2b9f258126 bump to dev release 0.71.1 (#7064) 2022-11-09 13:18:34 +01:00
85587c0c2a make take behave like first (#6893)
* fix take_1 behavior

* fix test case

* simplify code

* reverse back for first command

* fix example

* make arg required

* add test

* fix test message
2022-11-09 11:32:16 +01:00
JT
6cc4ef6c70 bump to 0.71, use 1.63 toolchain (#7061) 0.71.0 2022-11-09 06:54:00 +13:00