Commit Graph

1909 Commits

Author SHA1 Message Date
Reilly Wood
b650d1ef79
Remove --separator from seq date (#7096) 2022-11-11 20:16:44 +13:00
Reilly Wood
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
David Matos
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
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
Leon
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
Dan Davison
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
Dan Davison
fe14e52e77
Collapse some help commands columns into a single column (#7052) 2022-11-09 17:44:32 -08:00
Reilly Wood
24d72ca43c
Simplify seq char (#7054)
* Simplify `seq char`

* Fix input/output tests
2022-11-09 17:06:47 -08:00
Darren Schroeder
457f7889df
use path.try_exist() to fix silent errors (#7069) 2022-11-09 16:54:43 -08:00
raccmonteiro
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
raccmonteiro
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
Reilly Wood
aed8d3800b
Fix CI failures after PR merge conflicts (#7072) 2022-11-10 00:24:57 +01:00
Darren Schroeder
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
Reilly Wood
e18fb13616
Make seq output type consistent (#7045) 2022-11-10 11:19:02 +13:00
Reilly Wood
2201bd9b09
Require column name(s) in sort-by (#7041) 2022-11-10 11:16:51 +13:00
Reilly Wood
da8f6c5682
Require input for date format (#7043) 2022-11-10 11:16:14 +13:00
Reilly Wood
14d7ba5cc9
Remove --predicate flag from find (#7042) 2022-11-10 11:15:17 +13:00
Reilly Wood
5ee096232c
Remove sqlparser SQLite commands (#7040) 2022-11-10 11:14:48 +13:00
WindSoilder
c259ef41bd
update polar to 0.25 (#6988) 2022-11-10 11:07:38 +13:00
Leon
2c238aea6a
Fixed $in in where blocks (#6976) 2022-11-10 11:05:15 +13:00
nibon7
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
Dan Davison
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
Leon
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
Darren Schroeder
2b9f258126
bump to dev release 0.71.1 (#7064) 2022-11-09 13:18:34 +01:00
WindSoilder
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) 2022-11-09 06:54:00 +13:00
Stefan Holderbach
3d8d7787de
Pin reedline to 0.14.0 release (#7050)
See release notes:
https://github.com/nushell/reedline/releases/tag/v0.14.0
2022-11-07 21:31:15 +01:00
Dan Davison
5ee7847035
Add accidentally missing tests of some command examples (#7035)
* Add missing tests of examples

* Fix broken tests due to externals not being in working set

* Comment out `where` test due to bug
2022-11-06 09:53:25 -08:00
mike
8a812cf03c
added some search-terms to the platform category (#7021)
* added some search-terms to the `platform` category

* removed the redundant `sleep` search-term

* removed the redundant `gradients` search-term
2022-11-06 18:11:04 +01:00
Dan Davison
9a1cedfd08
Add expected result to test (#7031) 2022-11-06 18:09:56 +01:00
Alex Saveau
be5d71ea47
Run a round of clippy --fix to fix a ton of lints (#7006)
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-04 15:11:17 -05:00
Alex Saveau
36ae384fb3
Improve do command docs (#6975) 2022-11-05 07:50:56 +13:00
Stefan Holderbach
2c4048eb43
Refactor ansi stripping into nu-utils functions (#6966)
Allows use of slightly optimized variants that check if they have to use
the heavier vte parser. Tries to avoid unnnecessary allocations. Initial
performance characteristics proven out in #4378.

Also reduces boilerplate with right-ward drift.
2022-11-05 07:49:45 +13:00
Access
b9195c2668
fix: fixcd (#6799)
* fix: fixcd

try to fix

Log: try to fix the bug with can enter a permisson error fold

* change wording

* fat

* fmt

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2022-11-05 07:38:39 +13:00
Darren Schroeder
bb968304da
bump rust-toolchain to 1.64 (#7005)
* bump rust-toolchain to 1.64

* 1.64 clippy
2022-11-04 10:27:23 -05:00
David Matos
ca9bf19041
highlight term on PipelineData::Value() (#6997) 2022-11-04 08:42:16 -05:00
JT
ecfee4c542
Remove unnecessary clone in par-each (#6995)
* Remove unnecessary clone in par-each

* clippy
2022-11-04 18:07:28 +13:00
Leon
43aec8cdbe
Fix $in in blocks given to any and all (#6951)
* Fix $in in blocks given to `any` and `all` (closes #6917)

* Fix help message typos

* Fix tests ($in doesn't work in examples?!)

* Fix formatting
2022-11-01 11:36:54 -07:00
WindSoilder
e46d610f77
Refactor: finish refactor on commands which take optional cell paths. (#6961)
* refactor on conversions module

* finish refactor on strings command

* simplify code

* rename from ArgumentsCp to CellPathOnlyArgs

* fmt code

* refactor on hash relative commands
2022-11-01 12:40:11 +01:00
Stefan Holderbach
1d95861a09
Remove inadvertent dep on original ansi_term (#6965)
Is default feature in `lscolors`. Not needed for function as we use
crossterm backend in this case.
2022-11-01 12:27:20 +13:00
Darren Schroeder
f48de73236
change str distance to output value::int (#6963)
* change str distance to output value::int

* update the test
2022-10-31 10:28:04 -05:00
Darren Schroeder
0b4daa66b0
tweak upsert help text (#6962)
* tweak upsert help text

* more tweaks
2022-10-31 08:18:11 -05:00
WindSoilder
457514590d
Refactor: introduce general operate commands to reduce duplicate code (#6879)
* make format filesize more flexible

* make code simpler

* finish refactor on bytes commands

* finish refactor on str commands

* fimplify code

* rename from column_paths to cell_paths
2022-10-29 16:29:46 -05:00
Mel Massadian
843d8c2242
Make default for mv safer, require -f to overwrite (#6904)
* fix:  "saner" default for mv

fixes #6747

As highlighted in the issue, the default behavior of nu currently
is to overwrite the destination file without notice.
This is not a "standard" expectation users that want this behavior
can create a dedicated alias.

* fix: 📝 edit the comment

* fix:  updated the tests

* fix: 🚧 use --force for case test
2022-10-29 22:16:29 +02:00
WindSoilder
4f7f6a2932
Friendly error message for access beyond end (#6944)
Adds `ShellError::AccessEmptyContent`
2022-10-29 19:47:50 +02:00
Stefan Holderbach
7039602e4d
Move nu-test-support into dev deps on nu-command (#6940)
This reduces the number of dependencies to build for `cargo build` or
`cargo run` by around 19.

Will not speed up CI as we need to `cargo test` but should help for
`cargo install` or users just building from source.
Time saved on my machine ~0.8 secs so likely unnoticable in noise.

Larger future goal is reducing longer dependency chains to allow more
parallel compilation.
2022-10-29 19:39:27 +02:00
Reilly Wood
acb7aff6fb
Fix feature flag for open test (#6935) 2022-10-28 20:25:19 -07:00
Darren Schroeder
8940ee6c3f
enable ability to upsert into a list like update (#6932) 2022-10-28 18:13:14 -05:00
Maxim Zhiburt
66c2a36123
table: Show truncated record differently (#6884)
Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2022-10-28 14:00:10 +02:00
Stefan Holderbach
834522d002
Fix each while behavior when printing. (#6897)
Fixes #6895

Warning: `Iterator::map_while` does not return a `FusedIterator`!
Depending on the consuming adaptor or code (e.g. for loop) the iteration
may be stopped but this is not guaranteed.

Adds a test example but Examples handle iterators like
`FusedIterator` and thus don't catch the regression

Cleanup the message on another test
2022-10-27 23:45:45 +02:00
Leon
f281cd5aa3
Update merge to also take single records (#6919) 2022-10-27 09:00:26 -07:00
Leon
5add5cbd12
Further edits to help messages (#6913) 2022-10-26 09:36:42 -07:00
Andrey Filipenkov
902aad6016
fix description of build-string's second example (#6912) 2022-10-26 09:36:31 -05:00
Mel Massadian
13f87857cf
docs: 📝 add "map" to each's search terms (#6903) 2022-10-25 21:24:27 +02:00
Reilly Wood
e0cc2c9112
Make get 1 error message better (#6892) 2022-10-24 18:22:57 -07:00
Stefan Holderbach
92ab8b831b
Reduce required dependencies for diagnostics (#6648)
Disable backtrace on miette
- gimli crate requires several seconds
Disable diagnostics on wax
- depends on an outdated miette version

Builds fine, no observable loss in diagnostics quality of life

Removes 10 crates that have to be compiled.
2022-10-24 21:42:32 +02:00
Stefan Holderbach
6a7a60429f
Remove unnecessary #[allow(...)] annotations (#6870)
* Remove unnecessary `#[allow]` annots

Reduce the number of lint exceptions that are not necessary with the
current state of the code (or more recent toolchain)

* Remove dead code from `FileStructure` in nu-command

* Replace `allow(unused)` with relevant feature switch

* Deal with `needless_collect` with annotations

* Change hack for needless_collect in `from json`

This change obviates the need for `allow(needless_collect)`
Removes a pessimistic allocation for empty strings, but increases
allocation size to `Value`

Probably not really worth it.

* Revert "Deal with `needless_collect` with annotations"

This reverts commit 05aca98445.

The previous state seems to better from a performance perspective as a
`Vec<String>` is lighter weight than `Vec<Value>`
2022-10-24 20:12:16 +02:00
Stefan Holderbach
79fd7d54b2
Wrap open parse errors from from commands (#6877)
* Wrap `open` parse errors from `from` commands

Minimal fix for #6843

This propagates the underlying errors from the called `from` commands
and adds a top-level error with the full path and the understood file
extension and resulting called command.

* Repoint inner span for `from ...` to `open`

* Add actionable message: refer to help or use --raw
2022-10-24 20:09:19 +02:00
nibon7
ebca840d91
Add support to render right prompt on last line of the prompt (#6781)
* Add support to render right prompt on last line of the prompt

* reset reedline to main branch

* update reedline to fix right prompt to be rendered correctly

* reset reedline to main branch again
2022-10-23 16:18:26 +02:00
Reilly Wood
17b2bcc125
Support range in str substring (#6867) 2022-10-23 11:42:17 +02:00
Leon
24a98f8999
Mildly edited a small handful of help messages (#6868)
* Edited a handful of help messages

* Remove line break as instructed by clippy
2022-10-23 02:02:52 -04:00
Filip Andersson
e49b359848
Bumps Windows 0.37 -> 0.42. (#6865) 2022-10-22 17:59:44 -07:00
Access
c9fb381d69
feat: coredump (#6791)
fix issue in https://github.com/nushell/nushell/issues/5903
return Error to pipeline_data, if match error, then return error
directly
2022-10-22 20:24:58 +02:00
Maxim Zhiburt
a3dce8ff19
table -e Fix stackoverflow (cause endless empty list) (#6847)
Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2022-10-22 11:52:32 -05:00
pwygab
3f555a6836
add more helpful error for calling a decl that exists in a module (#6752)
* add more helpful error for calling a decl that exists in a module

* accord to suggestions

* make error more helpful
2022-10-22 11:41:31 -05:00
nibon7
ab0a6b6ca6
path: fix error message (#6860)
Closes #6819
2022-10-22 06:42:46 -05:00
Reilly Wood
e3bf6fdfc0
Print command help in base from+to commands (#6856) 2022-10-21 10:08:57 -07:00
Maxim Zhiburt
46c0d29c08
table/ Fix paging indexing (#6850)
* table/ Fix paging indexing

close #6840

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Add test for pagging with row_overlapping

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2022-10-21 18:02:25 +02:00
nibon7
c6436eb32f
rm: don't update target_exists every time in the loop (#6837) 2022-10-21 07:42:29 -07:00
Maxim Zhiburt
b2c29117d9
table -e align key to 2nd line (#6842)
Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2022-10-21 06:29:55 -05:00
WindSoilder
10aa86272b
Allow captured stderr saving to file (#6793)
* support redirect stderr to file

* fix test

* fix test

* fix test
2022-10-20 07:56:44 -05:00
Dan Davison
5eee33c7e4
Tab inline completion (#6802)
* Make Tab insert (partial) completion instead of select next menu item

* Use reedline feature branch

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
2022-10-20 23:39:48 +13:00
pwygab
5e748ae8fc
make ++ append lists (#6766)
* make `++` append lists

* fmt

* fix for database
2022-10-20 23:28:18 +13:00
nibon7
7336e1df1a
rm: fix error span when targets doesn't exists (#6815)
Closes #6810
2022-10-20 10:00:25 +02:00
Darren Schroeder
a724a8fe7d
bump to dev version 0.70.1 (#6814) 2022-10-20 18:04:10 +13:00
JT
9ef65dcd69
Bump to 0.70 (#6800) 2022-10-19 07:13:36 +13:00
Stefan Holderbach
f0420c5a6c
Pin reedline to the 0.13.0 release (#6789)
See the release notes:

https://github.com/nushell/reedline/releases/tag/v0.13.0
2022-10-17 23:45:28 +02:00
Dan Davison
ce809881eb
Rename query dfr -> query df (#6777) 2022-10-16 21:04:48 +02:00
Russell Chan
ec8e57cde9
Add search terms to roll commands (#6761) 2022-10-16 13:04:22 +02:00
WindSoilder
a498234f1d
fix stdout hangged on (#6715) 2022-10-15 14:29:29 -05:00
HannahZhuSWE
7d5d53cf85
Add search terms to arg dataframe commands (#6724)
* added search terms for arg prefixed dataframe commands

* remove search terms that already produce results
2022-10-15 12:49:09 -05:00
Kyle Anderson
1572808adb
Filter out empty glob patterns to "glob" command (#6707)
* Filter out empty glob patterns

An empty argument to the "glob" command will now produce an empty result.
Working towards nushell/nushell#6653.

* Run `cargo fmt --all`

Just autoformatted the repo so that CI passes and we have a consistent code
format across modules.

* Treat empty glob argument as error

The glob command will now report an empty string argument as an error instead
of silently ignoring it.

See https://github.com/nushell/nushell/pull/6707#discussion_r993345013.

* Add tests for glob command

Two small tests for the glob command, one to check that the empty string errors
it, and another to sanity check the '*' glob, have been added.

* Rename glob sanity check star test

Co-authored-by: Kyle Anderson <kyle.anderson@uwaterloo.ca>
2022-10-15 18:00:38 +02:00
pwygab
9d77e3fc7c
Improve erroring of config nu and config env (#6730)
* improve errors for `config nu` and `config env`

* fix tests
2022-10-15 08:28:54 -05:00
Doru
e22f2e9f13
window --remainder (#6738)
* Implement window remainder, and save allocation

* Fallible memory reservation
2022-10-15 08:06:54 -05:00
Doru
da6f548dfd
Remove unnecessary clone (#6729) 2022-10-14 17:13:24 -05:00
Doru
b7f47317c2
Fix quadratic time complexity with large strides (#6727) 2022-10-14 15:17:47 -05:00
pwygab
5849e4f6e3
let alias list aliases (#6717)
* let `alias` list aliases

* fix highlighting

* Update parse_keywords.rs
2022-10-14 21:51:44 +02:00
Dylan Snelgrove
868d94f573
Add search terms for export commands (#6722)
Contributes to https://github.com/nushell/nushell/issues/5093
2022-10-14 12:02:22 -05:00
Darren Schroeder
1344ae3a65
add the ability to convert durations (#6723)
* add the ability to convert durations

* add conversion to floats if necessary
2022-10-14 11:46:48 -05:00
Zephaniah Ong
804b155035
Add search terms for uppercase (#6720)
* Add search terms for uppercase

* Add search terms

* Add search terms

* Change to parse

* Add search terms for from

* Add search terms for to

* Remove duplicate function

* Remove duplication of search terms

* Remove search term
2022-10-14 05:36:31 -05:00
HoLLy
9446e3960b
Fix invalid variable name in input command docs (#6716) 2022-10-13 12:42:24 -05:00
pwygab
90ba39184a
allow for $in to affect environment (#6649)
* allow for `$in` to affect environment

* fix for vars, overlays, env_hidden

* fmt

* carry over variables properly

* add test

* modify name, remove redundant

* fmt
2022-10-13 12:04:34 +03:00
Stefan Holderbach
d40a73aafe
Backport fixes from nushell/nushell.github.io#633 (#6712)
Co-authored-by: Eric Hodel <drbrain@segment7.net>

Co-authored-by: Eric Hodel <drbrain@segment7.net>
2022-10-12 19:14:16 +02:00
WindSoilder
5815f122ed
avoid freeze when capturing external stderr (#6700)
* avoid freeze when capturing external stderr

* try replace from sh to bash

* change description

* fmt code
2022-10-12 08:41:20 -05:00
WindSoilder
1998bce19f
avoid freeze for table print (#6688)
* avoid freeze for table print

* make failed_with_proper_exit_code work again

* add test case for table

* fix un-used import on windows
2022-10-10 07:32:55 -05:00
pwygab
2f1711f783
return gid and uid in numbers if name not found (#6684)
* return git and uid in numbers if name not found

* fmt
2022-10-10 14:29:16 +02:00
Jake Albert
34c8b276ab
Return Error on str replace RegEx parse fail (#6695) 2022-10-10 07:27:01 -05:00
Brian Myers
fde56cfe99
upgrade num-format (#6694) 2022-10-10 06:25:57 -05:00
Darren Schroeder
7910d20e50
add a new command to query the registry on windows (#6670)
* add a new command to query the registry on windows

* cross platform tweaks

* return nushell datatype

* change visibility of exec and registry commands
2022-10-07 13:54:36 -05:00
Artemiy
79ce13abef
To nuon escapes (#6660)
* Add tests for "to nuon" escaping handling

* Fix "to nuon" not escaping double quotations

* Fix "to nuon" double backslash

Fix value_to_string_without_quotes leaving escaped backslash in
non-quoted strings
2022-10-04 06:25:21 -05:00
Maxim Zhiburt
5921c19bc0
WIP/ Checkout to new tabled (#6286)
* nu-table/ Use latest tabled

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table/ Fix first column alignment

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table: Fix cargo clippy

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table: Fix color issue

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table: Fix footer row

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table: Bump tabled

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table: Bump tabled

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table: Bump tabled

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Update

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table/ Update

* Use latest tabled

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Add optional -e, -c argument to `table` command for different view

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Fix clippy

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Fix clippy

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Update

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Fix cargo clippy

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Fix tests

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* nu-table: Add footer into -e/c mode

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Publish new expand mode

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Add width ctrl for Expand mode

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Refactorings

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Refactorings

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Add tests

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Add tests

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Merge with main

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Fix clippy

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Fix tests

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Fix tests

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Bump tabled

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* Add record expand and fix empty list issue

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>

* refactoring

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2022-10-03 11:40:16 -05:00
Dan Davison
5959d1366a
Remove unnecessary flags from term size (#6651)
The columns and rows can be obtained individually using

(term size).columns
(term size).rows
2022-10-01 07:00:54 -05:00
WindSoilder
530ff3893e
Eval external command result immediately when using do command with -c (#6645)
* make capture error works better in do command

* remove into string test because we have no way to generate Value::Error for now
2022-09-30 07:14:02 -05:00
WindSoilder
6f59167960
Make semicolon works better for internal commands (#6643)
* make semicolon works with some internal command like do

* refactor, make consume external result logic out of eval_external

* update comment
2022-09-30 07:13:46 -05:00
unrelentingtech
4af0a6a3fa
Foreground process group management, again (#6584)
* Revert "Revert "Try again: in unix like system, set foreground process while running external command (#6273)" (#6542)"

This reverts commit 2bb367f570.

* Make foreground job control hopefully work correctly

These changes are mostly inspired by the glibc manual.

* Fix typo in external command description

* Only restore tty control to shell when no fg procs are left; reuse pgrp

* Rework terminal acquirement code to be like fish

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2022-09-29 13:37:48 -05:00
Darren Schroeder
6486364610
changed the way durations and filesizes are parsed (#6640) 2022-09-29 13:24:17 -05:00
pwygab
1a3762b905
prevent alias name from being filesize or number (#6595)
* prevent alias name from being filesize or number

* add test

* fmt
2022-09-28 17:08:38 -05:00
pwygab
32fbcf39cc
make first behave same way as last: always return list when with number argument (#6616)
* make `first` behave same way as `last`

* better behaviour

* fix tests

* add tests
2022-09-28 17:08:17 -05:00
Darren Schroeder
dd578926c3
add some float operations with filesize (#6618)
* add some float operations with filesize

* more changes

* update return values on filesize-filesize, duration-duration

* missed filesize in floordiv

* missed float * duration
2022-09-28 17:07:50 -05:00
Nano
5c99921e15
Table indexes (#6620)
* Table indexes

* Renamed to `show_table_indexes`

* Renamed to `table_index_mode`
2022-09-28 17:07:33 -05:00
Darren Schroeder
23bba9935f
bump to dev version 0.69.2 (#6635) 2022-09-28 17:06:21 -05:00
JT
8a5abc7afc
bump to 0.69.1 (#6631) 2022-09-28 15:48:01 +13:00
JT
ec711cb79d
remove -d and -t from touch (#6629)
* remove -d and -t from touch

* remove unused test import
2022-09-28 13:48:34 +13:00
JT
f2ad7fae1f
bump to updated reedline (#6626) 2022-09-28 12:08:42 +13:00
JT
3beaca0d06
bump to 0.69 (#6623) 2022-09-28 07:14:31 +13:00
Stefan Holderbach
f7647584a3
Clippy with the current stable toolchain (#6615)
Fix lints that are coming with rust 1.64

Passes with the earlier toolchain from `rust-toolchain.toml` as well.
2022-09-26 19:29:25 +02:00
JT
d66a5398d1
Remove month and year duration constants (#6613)
remove month/year/decade durations for parsing and units, but leave the humanized output for viewing
2022-09-26 09:55:13 +13:00
JT
43905caa46
touchup some clippy warnings in tests (#6612) 2022-09-26 09:06:13 +13:00
WindSoilder
b47bd22b37
Removes export env command (#6468)
* remove export_env command

* remove several export env usage in test code

* adjust hiding relative test case

* fix clippy

* adjust tests

* update tests

* unignore these tests to expose ut failed

* using `use` instead of `overlay use` in some tests

* Revert "using `use` instead of `overlay use` in some tests"

This reverts commit 2ae24b24c3.

* Revert "adjust hiding relative test case"

This reverts commit 4369af6d05.

* Bring back module example

* Revert "update tests"

This reverts commit 6ae94ef513.

* Fix tests

* "Fix" a test

* Remove remaining deprecated env functionality

* Re-enable environment hiding for `hide`

To not break virtualenv since the overlay update is not merged yet

* Fix hiding env in `hide` and ignore some tests

Co-authored-by: kubouch <kubouch@gmail.com>
2022-09-25 19:52:43 +03:00
MichelMunoz
7f21b7fd7e
6582 - Incorrect documentation for some string operations (#6610)
* 6582 - Incorrect documentation for some string operations

* Update crates/nu-command/src/strings/str_/contains.rs

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>

* Update crates/nu-command/src/strings/str_/ends_with.rs

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>

* Update crates/nu-command/src/strings/str_/index_of.rs

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>

* Update crates/nu-command/src/strings/str_/starts_with.rs

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>

* Run rustfmt

Co-authored-by: MichelMunoz <>
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
2022-09-25 18:09:09 +02:00
nibon7
0ab4e5af2a
version: show built time git branch (#6609) 2022-09-24 07:10:36 -05:00
Reilly Wood
848550771a
Fix mv data loss when changing folder case (step 1) (#6599)
* Fix mv data loss when changing folder case (step 1)

* Use same-file to detect when changing case on Windows
2022-09-23 11:09:31 -07:00
WindSoilder
d323ac3edc
fix sys info mem usage (#6607) 2022-09-23 11:47:52 -05:00
Tobias
2e23d4d734
fix issue 6602 (broken highlighting in find) (#6604)
* fix issue 6602 (broken highlighting in find)

Find uses highlight_search_string to see where the string was found. The problem was that the style would just "append" to the existing haystack (including the ANSI escape codes of LS_COLORS).

This first strips the ANSI escape codes out of the haystack before formatting the
output string.

* update formatting
2022-09-23 07:11:33 -05:00
Dan Davison
ad0c6bf7d5
Improve "Did you mean?" suggestions (#6579)
* Copy lev_distance.rs from the rust compiler

* Minor changes to code from rust compiler

* "Did you mean" suggestions: test instrumented to generate markdown report

* Did you mean suggestions: delete test instrumentation

* Fix tests

* Fix test

`foo` has a genuine match: `for`

* Improve tests
2022-09-20 19:46:01 -05:00
Stefan Holderbach
9aed95408d
Add "space" key to bind in vi normal mode (#6590)
* Add "space" key to bind in vi normal mode

Implements #6586

No special logic to prevent you from binding it in other modes!
Needs a separate change to reedline to make it available in the default
listing of `keybindings list`.

* Update reedline to report the available `space`

Pulls in nushell/reedline#486
2022-09-20 13:04:35 +02:00
Darren Schroeder
71844755e5
add history session command (#6587) 2022-09-19 14:30:04 -05:00
Darren Schroeder
0b9dd87ca8
add history session id to $nu (#6585)
* add history session id to $nu

* get nushell to compile

* update test
2022-09-19 09:28:36 -05:00
Dan Davison
d704b05b7a
Improve uniq documentation (#6580) 2022-09-18 08:24:27 -07:00
nibon7
15ebf45f46
Apply clippy fix for rust 1.63.0 (#6576)
* Apply clippy fix to avoid extra allocation

error: `format!(..)` appended to existing `String`
  --> crates/nu-engine/src/documentation.rs:82:9
   |
82 |         long_desc.push_str(&format!("\n{G}Subcommands{RESET}:\n"));
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::format-push-string` implied by `-D warnings`
   = help: consider using `write!` to avoid the extra allocation
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

error: `format!(..)` appended to existing `String`
  --> crates/nu-engine/src/documentation.rs:96:9
   |
96 |         long_desc.push_str(&format!("\n{G}Parameters{RESET}:\n"));
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider using `write!` to avoid the extra allocation
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

error: `format!(..)` appended to existing `String`
   --> crates/nu-engine/src/documentation.rs:128:9
    |
128 |         long_desc.push_str(&format!("\n{}Examples{}:", G, RESET));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider using `write!` to avoid the extra allocation
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

error: `format!(..)` appended to existing `String`
   --> crates/nu-engine/src/documentation.rs:202:5
    |
202 |     long_desc.push_str(&format!("\n{}Flags{}:\n", G, RESET));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider using `write!` to avoid the extra allocation
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

error: could not compile `nu-engine` due to 4 previous errors

* Apply clippy fix to avoid deref on an immutable reference

error: deref on an immutable reference
   --> crates/nu-command/src/dataframe/eager/sql_context.rs:188:77
    |
188 |                         SetExpr::Select(select_stmt) => self.execute_select(&*select_stmt)?,
    |                                                                             ^^^^^^^^^^^^^
    |
    = note: `-D clippy::borrow-deref-ref` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
help: if you would like to reborrow, try removing `&*`
    |
188 |                         SetExpr::Select(select_stmt) => self.execute_select(select_stmt)?,
    |                                                                             ~~~~~~~~~~~
help: if you would like to deref, try using `&**`
    |
188 |                         SetExpr::Select(select_stmt) => self.execute_select(&**select_stmt)?,
    |                                                                             ~~~~~~~~~~~~~~

error: deref on an immutable reference
   --> crates/nu-command/src/database/values/dsl/expression.rs:252:15
    |
252 |         match &*expr {
    |               ^^^^^^ help: if you would like to reborrow, try removing `&*`: `expr`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref

error: could not compile `nu-command` due to 2 previous errors
2022-09-17 12:10:32 -05:00
Dan Davison
b086f34fa2
Reinstate -a short form of save --append (#6575)
Present before engine-q merge (e.g.
265ee1281d) but not included when
--append was re-introduced at
https://github.com/nushell/nushell/pull/4744.
2022-09-17 07:02:17 -05:00
WindSoilder
5491634dda
escape external args (#6560) 2022-09-17 06:07:45 -05:00
Jakub Žádník
e7bf89b311
Add export-env eval to use command (#6572) 2022-09-17 02:36:17 +03:00
Darren Schroeder
4fdfd3d15e
rename with_sql to query dfr (#6568)
* rename with_sql to query dfr

* add search terms

* update example command
2022-09-16 08:34:58 -05:00
Kangaxx-0
35a521d762
Fix 6529 - Trim overlay name (#6555)
* trim overlay name

* format

* Update tests/overlays/mod.rs

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>

* cleanup

* new tests

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
2022-09-16 10:27:12 +03:00
Darren Schroeder
f0ae6ffe12
update sql-parser crate and all the files it touches (#6566)
* update sql-parser crate and all the files it touches

* undo adding extra as a default feature
2022-09-15 18:03:43 -05:00
Darren Schroeder
10b9c65cb7
synchronize the db commands with file names (#6565) 2022-09-15 14:39:36 -05:00
Darren Schroeder
02e3f49bce
provide a way to use sql to query dataframes (#6537) 2022-09-15 09:22:00 -05:00
nibon7
f6c791f199
Use style from lscolors to render the rest of the filename (#6564)
* Use style from lscolors to render the rest of the filename

Related: https://github.com/nushell/nushell/pull/6556#issuecomment-1246681644

* Make cargo-clippy happy
2022-09-15 06:12:20 -05:00
Darren Schroeder
cc62e4db26
update to the latest sysinfo crate (#6563) 2022-09-15 05:47:40 -05:00
nibon7
56bb9e92cb
Use stripped path for lscolors to get style (#6561) 2022-09-15 05:34:47 -05:00
nibon7
b159bf2c28
Make clickable links smarter (#6556)
* Disable clickable links when we can't get metadata of files

Fixes #6498

* Refactor path name rendering related code

* Make clickable links smarter

* Remove unneeded clone

* Return early if `use_ls_colors` is disabled
2022-09-14 05:55:41 -05:00
pwygab
12a0fe39f7
default to $nothing if cellpath not found (#6535)
* default to  if cellpath not found

* fmt

* add test

* fix test

* fix clippy

* move behaviour behind `-i` flag

* prevent any possibility of an unspanned error

* ignore all errors

* seperate testes

* fmt
2022-09-13 16:17:16 +03:00
Kangaxx-0
8564c5371f
Add more overlay use usage (#6551) 2022-09-13 10:38:21 +03:00
Aron Nopanen
d08212409f
Support Arrow IPC file format with dataframes (#6548)
* Add support for Arrow IPC file format

Add support for Arrow IPC file format to dataframes commands. Support
opening of Arrow IPC-format files with extension '.arrow' or '.ipc' in
the open-df command. Add a 'to arrow' command to write a dataframe to
Arrow IPC format.

* Add unit test for open-df on Arrow

* Add -t flag to open-df command

Add a `--type`/`-t` flag to the `open-df` command, to explicitly specify
the type of file being used. Allowed values are the same at the set of
allowed file extensions.
2022-09-12 18:30:20 -05:00
Justin Ma
4490e97a13
Bump dev version to v0.68.2 (#6538) 2022-09-12 08:29:39 +12:00
Dan Davison
2bb367f570
Revert "Try again: in unix like system, set foreground process while running external command (#6273)" (#6542)
This reverts commit 1d18f6947e.
2022-09-11 15:14:58 -05:00
Dan Davison
4926865c4e
str collect => str join (#6531)
* Initialize join.rs as a copy of collect.rs

* Evolve StrCollect into StrJoin

* Replace 'str collect' with 'str join' everywhere

git ls-files | lines | par-each { |it| sed -i 's,str collect,str join,g' $it }

* Deprecate 'str collect'

* Revert "Deprecate 'str collect'"

This reverts commit 959d14203e.

* Change `str collect` help message to say that it is deprecated

We cannot remove `str collect` currently (i.e. via
`nu_protocol::ShellError::DeprecatedCommand` since a prominent project
uses the API:

b85542c31c/src/virtualenv/activation/nushell/activate.nu (L43)
2022-09-11 11:48:27 +03:00
unrelentingtech
9ee4086dfa
Add a 'commandline' command for manipulating the current buffer (#6492)
* Add a 'commandline' command for manipulating the current buffer

from `executehostcommand` keybindings. Inspired by fish:
https://fishshell.com/docs/current/cmds/commandline.html

* Update to development reedline

Includes nushell/reedline#472

Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-09-09 15:31:32 -05:00
Jakub Žádník
e76b3d61de
Require static path for source-env (#6526) 2022-09-08 23:41:49 +03:00
Stefan Holderbach
1adebefc3e
Improve wording around all and any (#6524)
* Improve wording around `all` and `any`

The role of the `predicate` for `all` and `any` was not as clear.

See #6499

* type-o

* type-o

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2022-09-08 08:45:01 -05:00
pwygab
d1e1d0ac3e
remove panic from lpad and rpad, change truncation behaviour for lpad (#6495)
* condense `lpad` and `rpad` into `pad`

* change description

* back to original names, add change
2022-09-08 14:29:56 +02:00
Kangaxx-0
02f92fa527
remove tests (#6515) 2022-09-07 20:19:29 -05:00
WindSoilder
aa92141ad7
Remove --encoding argument during register plugin (#6486)
* first implement new plugin protocol core logic

* fix debug body construct

* fix output message from plugin

* finish plugin commands calling

* fix tests and adjust plugin_custom_value call

* fmt code

* fmt code, fix clippy

* add FIXME comment

* change from FIXME to TODO
2022-09-07 09:07:42 -05:00
nibon7
80624267fd
Pass TERM environment var to clear (#6500)
* Pass `TERM` environment var to clear

* don't panic

* use IOErrorSpanned instead of IOError
2022-09-07 10:40:44 +02:00
JayceFayne
2030e25ddc
fix typo (#6508) 2022-09-07 16:16:55 +08:00
Justin Ma
c902d8bc0c
bump dev version to v0.68.1 (#6504) 2022-09-07 14:27:33 +12:00
JT
9273bb3f72
bump to 0.68 (#6501) 2022-09-07 06:29:01 +12:00
Stefan Holderbach
f7d3ccfc70
Pin reedline to 0.11.0 release (#6497)
Includes minor bugfixes around the history

Release notes:

https://github.com/nushell/reedline/releases/tag/v0.11.0
2022-09-06 11:29:51 +02:00
JT
d86350af80
Revert "Make $ on variable names optional (#6434)" (#6446)
This reverts commit 3cb9147f22.
2022-09-06 05:42:47 +12:00
adamijak
14512988ba
Rename all?, any? and empty? (#6464)
Rename `all?`, `any?` and `empty?` to `all`, `any` and `is-empty` for sake of simplicity and consistency.

- More understandable for newcomers, that these commands are no special to others.
- `?` syntax did not really aprove readability. For me it made it worse.
- We can reserve `?` syntax for any other nushell feature.
2022-09-05 16:41:06 +02:00
pwygab
daec3fc3d3
let path split keeps 'C:\' together (#6485)
* `path split` keeps 'C:\' together

* fmt

* fix clippt

* fix match arm
2022-09-04 23:32:09 -07:00
Jakub Žádník
3ed3712fdc
Fix overlays not preserving hidden env vars (#6475)
* Fix overlays not preserving hidden env vars

* Add a few more test

* Add one more test of resetting hidden env vars

* Move removed source-env tests
2022-09-04 20:32:06 +03:00
Jakub Žádník
f46962d236
Fix scoped overlay use not finding a module (#6474)
* Add source-env test for dynamic path

* Use correct module ID for env overlay imports

* Remove parser check from "overlay list"

It would cause unnecessary errors from some inner scope if some
overlay module was also defined in some inner scope.

* Restore Cargo.lock back

* Remove comments
2022-09-04 18:36:42 +03:00
pwygab
e81689f2c0
Allow for rejecting nested record cells (#6463)
* add new function to remove data at a cellpath; allow reject to use cellpath

* add tests

* fmt

* fix clippt

* get it working properly with lists of records

* fix clippy, hopefully

* fix clippy, hopefully 2
2022-09-03 07:35:36 -05:00
pwygab
34e58bc5d6
add tests, deal with pipes, newlines, tabs for to nuon (#6391)
* remove unnecessary FlatShape

* add proptest

* remove files that belonged in another PR

* more tests, more chars

* add exception for parser error unrelated ot PR
2022-09-01 14:08:19 +02:00
WindSoilder
fbe9d6f529
Highlight source value as well as failure point. (#6442)
* show multiple errors at once for some commands

* change from invalid item to source value
2022-09-01 12:20:22 +02:00
unrelentingtech
b27148d14b
Fix build on *BSD, illumos, etc. (#6456)
* nu-path: use 'linux' code on all non-macOS unix

* nu-command: cfg() the Ps command to platforms it's actually implemented on

* nu-system: cfg() the Ps test to the platforms Ps is implemented on
2022-09-01 12:34:26 +12:00
Darren Schroeder
4858a9a817
Revert "Add support for optional list stream output formatting (#6325)" (#6454)
This reverts commit ec4e3a6d5c.
2022-08-31 18:09:40 -05:00
WindSoilder
3ec53e544c
remove capnp protocol for plugin... (#6421)
* remove capnp protocol for plugin...

* remove relative doc
2022-08-31 17:33:30 -05:00
JT
c52d45cb97
Move from source to source-env (#6277)
* start working on source-env

* WIP

* Get most tests working, still one to go

* Fix file-relative paths; Report parser error

* Fix merge conflicts; Restore source as deprecated

* Tests: Use source-env; Remove redundant tests

* Fmt

* Respect hidden env vars

* Fix file-relative eval for source-env

* Add file-relative eval to "overlay use"

* Use FILE_PWD only in source-env and "overlay use"

* Ignore new tests for now

This will be another issue

* Throw an error if setting FILE_PWD manually

* Fix source-related test failures

* Fix nu-check to respect FILE_PWD

* Fix corrupted spans in source-env shell errors

* Fix up some references to old source

* Remove deprecation message

* Re-introduce deleted tests

Co-authored-by: kubouch <kubouch@gmail.com>
2022-09-01 08:32:56 +12:00
Reilly Wood
11531b7630
Upgrade which dependency to fix case on Windows (#6453) 2022-08-31 09:50:18 -07:00
Darren Schroeder
2591bd8c63
add more color highlighting to help (#6449) 2022-08-31 20:15:03 +12:00
Reilly Wood
9c58f2a522
Disable clickable links in SSH sessions (#6439)
* Disable clickable links in WSL and SSH sessions

* Revert WSL change; disable links in SSH only
2022-08-29 07:52:55 -07:00
JT
3cb9147f22
Make $ on variable names optional (#6434)
* DRAFT: make var dollar optional

* couple fixes

* fix some tests + cleanup
2022-08-29 14:35:55 +12:00
Scott Boggs
f1d72e2670
better error handling for nu_command::env::conig::utils::get_editor (#6430) 2022-08-28 12:56:55 +03:00
WindSoilder
f1e7a01b2e
shows wrong item when each command runs to failed. (#6437)
* add --wrong-item for each command

* fix test

* show multiple errors at once
2022-08-28 11:40:14 +03:00
WindSoilder
b88ace4cde
keep raw for variable inputed argument (#6426)
* keep raw for variable inputed argument

* fix clippy for windows

* make test runs on windows
2022-08-27 08:22:02 -05:00
Jakub Žádník
34d7c17e78
Bring module's environment when activating overlay (#6425) 2022-08-27 01:32:19 +03:00
Darren Schroeder
3f1824111d
add the ast command to peek at the internals of nushell (#6423)
* add the ast command to peak at the internals of nushell

* fixed a bug in an example
2022-08-26 14:48:48 -05:00
WindSoilder
fbae137442
Try to make argument with quotes for external command better (#6420)
* fix arg quote for external

* adjust comment
2022-08-26 06:50:41 -05:00
nibon7
9850424251
Make run_external parameter required (#6418) 2022-08-26 06:31:33 -05:00
Herlon Aguiar
918ec9daa8
nu-command/filters: drop column check positive value (#6412) 2022-08-25 19:03:18 +03:00
nibon7
7b07e976b8
Fix the span of "invalid time zone" (#6411)
Signed-off-by: nibon7 <nibon7@163.com>

Signed-off-by: nibon7 <nibon7@163.com>
2022-08-25 13:21:54 +02:00
Darren Schroeder
5ebfa10495
convert string duration to named duration (#6406) 2022-08-24 14:45:51 -05:00
Reilly Wood
3f93dc2f1d
Always report errors in cp (#6404) 2022-08-24 10:39:28 -07:00
Stefan Holderbach
ab77bf3289
Fix search terms for str distance (#6398)
Redundancy with the command name is unnecessary and now tested since #6380 
Fixes CI failure
2022-08-24 11:49:03 +02:00
Stefan Holderbach
0afe1e4e67
Test command names and search terms for redundancy (#6380)
* Test commands for proper names and search terms

Assert that the `Command.name()` is equal to `Signature.name`

Check that search terms are not just substrings of the command name as
they would not help finding the command.

* Clean up search terms

Remove redundant terms that just replicate the command name.
Try to eliminate substring between search terms, clean up where
necessary.
2022-08-24 11:16:47 +02:00
Reilly Wood
ef26d539a7
Make cp errors more specific (#6396) 2022-08-23 21:32:41 -07:00
Darren Schroeder
ba6abd77c9
add another split words example (#6394) 2022-08-23 13:27:06 -05:00
Darren Schroeder
6fbc76bc0f
add edit distance/levenshtein command (#6383)
* add edit distance/levenshtein command

* change output to a record

* update test
2022-08-23 08:53:14 -05:00
pwygab
884382bac4
preserve space by letting to nuon only add quotes when necessary (#6379)
* preserve space by letting `to nuon` only add quotes when necessary

* fix CI, add quotes with colon

* fmt

* add more chars to blacklist
2022-08-23 06:51:07 -05:00
WindSoilder
9c4bbe3c63
Rename overlay commands (#6375)
* rename from overlay add to overlay use

* rename from overlay remove to overlay hide

* rename add to use_
2022-08-21 17:27:56 +03:00
Reilly Wood
c5ca839294
Add pause and cls to cmd.exe exceptions (#6371) 2022-08-21 07:21:27 -07:00
Darren Schroeder
5337a6dffa
add MessagePack as a plugin protocol (#6370) 2022-08-21 06:13:38 -05:00
pwygab
56ce10347e
let to nuon convert column names with spaces (#6376)
* let `to nuon` convert column names with spaces

* change test
2022-08-21 13:12:13 +03:00
Darren Schroeder
37bc90c62a
fix the way lists are rendered in markdown (#6369) 2022-08-20 21:04:30 -05:00
Darren Schroeder
99c42582fe
add a split words command (#6363)
* add a split words command

* changed regex
2022-08-20 05:55:54 +12:00
Jakub Žádník
5a56d47f25
Add export-env command (#6355)
* WIP Start export-env

* Add missing file

* Do not modify the parser

Let's leave that for later

* Enable tests for export-env; Fmt
2022-08-18 23:24:39 +03:00
nibon7
529c98085a
Return error when kill didn't terminate successfully (#6354)
* Return error when `kill` didn't terminate successfully

Signed-off-by: nibon7 <nibon7@163.com>

* add test

Signed-off-by: nibon7 <nibon7@163.com>

Signed-off-by: nibon7 <nibon7@163.com>
2022-08-18 11:58:51 -05:00
Yura Shatunov
2b955f82b7
Fix #6330 (#6332) 2022-08-18 10:53:46 -05:00
Darren Schroeder
1843fdc060
create clickable links in ls output if configured (#6333)
* create clickable links in ls output if configured

* move some comments
2022-08-18 05:45:49 -05:00
panicbit
ec4e3a6d5c
Add support for optional list stream output formatting (#6325)
* add support for optional list stream output formatting

* cargo fmt

* table: add ValueFormatter test
2022-08-18 05:44:53 -05:00
WindSoilder
1d18f6947e
Try again: in unix like system, set foreground process while running external command (#6273)
* Revert "Fix intermittent test crash (#6268)"

This reverts commit 555d9ee763.

* make a working version again

* try second impl

* add

* fmt

* check stdin is atty before acquire stdin

* add libc

* clean comment

* fix typo
2022-08-18 05:41:01 -05:00
Justin Ma
4bbdb73668
Bump dev version (#6350) 2022-08-18 21:14:17 +12:00
Antoine Stevan
62d3497bbb
fix links to the "think in nu" page in --help (#6348)
This commit uses `sed` on all the files of the code base to
replace each and every instance of https://www.nushell.sh/book/thinking_in_nushell.html,
which is a broken link, to https://www.nushell.sh/book/thinking_in_nu.html,
which is the new URL to the book page.

This exact command was
```nushell
ls **/* -f |
    where type == file |
    each {
        |it|
        sed -i 's|https://www.nushell.sh/book/thinking_in_nushell.html|https://www.nushell.sh/book/thinking_in_nu.html|' $it.name
    }
```

Co-authored-by: amtoine <44101798+AntoineStevan@users.noreply.github.com>
2022-08-17 13:51:07 -04:00
JT
33674d3a98
bump to 0.67 (#6336) 2022-08-17 05:47:47 +12:00
Stefan Holderbach
cc263ee15d
Update to reedline 0.10.0 (#6327)
Release notes:

https://github.com/nushell/reedline/releases/tag/v0.10.0
2022-08-15 13:00:00 +02:00
WindSoilder
21770367e2
make date format supports locale (#6306)
* add --locale flag to make output support locale

* implement again based on nu-utils get_system_locale_string

* add comment
2022-08-14 08:07:04 -05:00
Richard Braakman
6145f734b7
Add repository info to all workspace crates (#6320)
This helps people who find these crates on crates.io
2022-08-14 07:21:20 -05:00
Fernando Herrera
9d8d305e9d
lazy dataframe reader (#6321)
* lazy dataframe reader

* correct space for polars dependencies
2022-08-14 13:06:31 +01:00
Andrés N. Robalino
eb55fd2383
cmd(df/first): returns the first row by default. (#6312) 2022-08-13 14:08:00 -05:00
Reilly Wood
613d2fb8df
Bump chrono dependency to fix panic (#6317) 2022-08-13 11:21:28 -07:00
Jakub Žádník
8783742060
Add 'as' keyword to 'overlay add' (#6314) 2022-08-13 17:28:18 +03:00
Jakub Žádník
20528e96c7
Add hide-env to hide environment variables (#6313)
* Add hide-env to hide env vars; Cleanup tests

Also, there were some old unalias tests that I converted to hide.

* Add missing file

* Re-enable hide for env vars

* Fix test

* Rename did you mean error back

It was causing random tests to break
2022-08-13 12:55:06 +03:00
Reilly Wood
3b6c4c1bb5
run_external: only suggest alternative commands when file not found (#6311) 2022-08-13 00:27:50 -04:00
Björn Richter
cb18dd5200
Add decimals to int when using into string --decimals (#6085)
* Add decimals to int when using `into string --decimals`

* Add tests for `into string` when converting int with `--decimals`

* Apply formatting

* Merge `into_str` test files

* Comment out unused code and add TODOs

* Use decimal separator depending on system locale

* Add test helper to run closure in different locale

* Add tests for int-to-string conversion using different locales

* Add utils function to get system locale

* Add panic message when locking mutex fails

* Catch and resume panic later to prevent Mutex poisoning when test fails

* Move test to `nu-test-support` to keep `nu-utils` free of `nu-*` dependencies

See https://github.com/nushell/nushell/pull/6085#issuecomment-1193131694

* Rename test support fn `with_fake_locale` to `with_locale_override`

* Move `get_system_locale()` to `locale` module

* Allow overriding locale with special env variable (when not in release)

* Use special env var to override locale during testing

* Allow callback to return a value in `with_locale_override()`

* Allow multiple options in `nu!` macro

* Allow to set locale as `nu!` macro option

* Use new `locale` option of `nu!` macro instead of `with_locale_override`

Using the `locale` options does not lock the `LOCALE_OVERRIDE_MUTEX`
mutex in `nu-test-support::locale_override` but instead calls the `nu`
command directly with the `NU_LOCALE_OVERRIDE` environment variable.
This allows for parallel test excecution.

* Fix: Add option identifier for `cwd` in usage of `nu!` macro

* Rely on `Display` trait for formatting `nu!` macro command

- Removed the `DisplayPath` trait
- Implement `Display` for `AbsolutePath`, `RelativePath` and
  `AbsoluteFile`

* Default to locale `en_US.UTF-8` for tests when using `nu!` macro

* Add doc comment to `nu!` macro

* Format code using `cargo fmt --all`

* Pass function directly instead of wrapping the call in a closure

https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

* Pass function to `or_else()` instead of calling it inside `or()`

https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

* Fix: Add option identifier for `cwd` in usage of `nu!` macro
2022-08-12 21:13:50 -05:00
Jakub Žádník
c3efb12733
Allow overlays to import prefixed definitions (#6301)
* WIP

* Fix overlay prefix not preserving correctly

* Work around failing REPL tests

* Remove wrong code when removing with --keep-custom
2022-08-12 21:06:51 +03:00
Fernando Herrera
ae64c58f59
Polars upgrade 0.23 (#6303)
* more lazy expressions

* upgrade polars and correct functions

* arg-where example

* cargo clippy

* restore modified filter files

* correct string addition with str

* correct string addition with str

* correct message in test
2022-08-12 13:10:36 +01:00
Stefan Holderbach
c2f4969d4f
Clippy fix for Rust 1.63 (#6299)
Take more sensitive lints into account

Somewhat ugly in some cases is the replacement of `.get(0)` with
`.first()`
2022-08-11 11:54:54 -05:00
Darren Schroeder
58094987ff
update a few nushell dependencies (#6291)
* update a few nushell dependencies

* update a test
2022-08-10 14:56:15 -05:00
Darren Schroeder
ce26ef97e4
Revert "Allow using the system's copy of zstd for Polars (#6232)" (#6292)
This reverts commit 9f131d998d.
2022-08-10 13:26:04 -05:00
nibon7
45dd7d8770
Fix panic when building without git (#6289)
Signed-off-by: nibon7 <nibon7@163.com>

Signed-off-by: nibon7 <nibon7@163.com>
2022-08-10 10:31:12 -05:00
WindSoilder
0f10d984c3
add -n for path expand, so it doesn't follow symlink (#6255)
* add -p for path expand, so it doesn't follow symlink

* fix arg name

* rename from no-dereferenct to no-follow-link

* rename from no-follow-link to no-symlink, and change short -p to -n

* follow strict first

* fix

* simplify test

* fix clippy

* fix test on windows
2022-08-10 08:43:56 -05:00
Darren Schroeder
2e5d981a09
add search terms to ignore command (#6288) 2022-08-10 08:42:21 -05:00
nibon7
271fda7c91
Return error when moving a source directory to a target directory which contains a subdirectory with the same name as the source (#6284)
Fixes #6275

Signed-off-by: nibon7 <nibon7@163.com>
2022-08-10 06:51:11 -05:00
Reilly Wood
0e5886ace1
Fix unused import warning on Linux+Mac (#6281) 2022-08-10 00:28:03 -04:00
Reilly Wood
4b89c5f900
ignore tests that fail on local machines (#6279) 2022-08-09 23:30:40 -04:00
Reilly Wood
dcab255d59
Support running batch files without typing their extension (#6278)
* Support running batch files without typing their extension

* suppress warning
2022-08-09 19:24:08 -04:00
Darren Schroeder
e10ef4aaae
bump lscolors to v12.0 (#6272) 2022-08-09 09:32:30 -05:00
Darren Schroeder
0b70ca8451
escape single quotes and remove ansi escape sequences (#6271)
* escape single quotes and remove ansi escape sequences prior to storing strings in db

* clippy
2022-08-09 07:58:36 -05:00
JT
555d9ee763
Fix intermittent test crash (#6268)
* Fix intermittent test crash

* fix windows build
2022-08-09 14:06:46 +12:00
JT
121b801baa
bump dev version ahead of language changes (#6267) 2022-08-09 08:15:41 +12:00
Darren Schroeder
9adcecbbf1
new command into sqlite allows you to take lists and create a sqlite db (#6266) 2022-08-08 14:12:42 -05:00
Winter
9f131d998d
Allow using the system's copy of zstd for Polars (#6232) 2022-08-08 10:58:40 -05:00
Reilly Wood
cd0a04f02a
Delete most deprecated commands (#6260) 2022-08-08 07:46:59 -07:00
nibon7
2f0cb044a5
Refactor shell listing related code (#6262)
* Refactor shell listing related code

Signed-off-by: nibon7 <nibon7@163.com>

* add test

Signed-off-by: nibon7 <nibon7@163.com>
2022-08-08 06:31:24 -05:00
Darren Schroeder
8b55757a0b
add more verbose error messages to mv (#6259)
* add more verbose error messages to mv

* tweak output

* clippy

* yet another tweak
2022-08-07 15:25:05 -05:00
Reilly Wood
84fae6e07e
Suggest alternative when command not found (#6256)
* Suggest alternative when command not found

* Add tests for command-not-found suggestions

* Put suggestion in label

* Fix tests
2022-08-07 14:40:41 -04:00
nibon7
63e220a763
Refactor shell switching related code (#6258)
* Refactor shell switching related code

Signed-off-by: nibon7 <nibon7@163.com>

* add tests

Signed-off-by: nibon7 <nibon7@163.com>

* fix tests

Signed-off-by: nibon7 <nibon7@163.com>
2022-08-07 13:30:40 -05:00
Reilly Wood
a96fc21f88
Windows: only shell out to cmd for specific commands (#6253) 2022-08-06 13:03:06 -07:00
nibon7
1ba5b25b29
Make g - switch to the last used shell (#6249)
* Make `g -` switch to the last used shell

Related #6223

Signed-off-by: nibon7 <nibon7@163.com>

* simplify error handling

Signed-off-by: nibon7 <nibon7@163.com>

* update NUSHELL_LAST_SHELL environment

Signed-off-by: nibon7 <nibon7@163.com>

* add test

Signed-off-by: nibon7 <nibon7@163.com>

* fix description

Signed-off-by: nibon7 <nibon7@163.com>
2022-08-06 10:11:03 -05:00
pwygab
a871f2344a
fix examples and let into decimal convert bools too (#6246) 2022-08-06 07:10:33 -05:00
Kangaxx-0
a217bc0715
Fix issue 6223 (#6241)
* Fix6223

* clippy fix

Co-authored-by: Frank <v-frankz@microsoft.com>
2022-08-06 07:09:14 -05:00
Justin Ma
48f1c3a49e
add bits ror and bits rol commands (#6224) 2022-08-05 15:40:01 +02:00
nibon7
692376e830
export get_shells and get_current_shell (#6236)
Signed-off-by: nibon7 <nibon7@163.com>
2022-08-05 07:58:40 -05:00
Justin Ma
cc99df5ef1
upgrade chrono to v0.4.20 (#6235) 2022-08-05 06:53:01 -05:00
Darren Schroeder
cdeb8de75d
replace the regex crate with the fancy-regex crate (#6227) 2022-08-04 14:51:02 -05:00