Commit Graph

149 Commits

Author SHA1 Message Date
JT
97eb8492a3
Improve $in handling (#5137)
* Simplify in logic

* Add tests

* more tests, and fixes
2022-04-09 09:41:05 +12:00
JT
4f974efeba
Move 'keep' to 'take' (#5123) 2022-04-08 08:49:28 +12:00
Darren Schroeder
4129f15eb9
update str find-replace to str replace (#5120) 2022-04-07 08:41:09 -05:00
Robert Broketa
690ec9abfa
Implement rest of touch flags (#5119)
* Add timestamp flag to `touch` command

* Add modify flag to `touch` command

* Add date flag to `touch` command

* Remove unnecessary `touch` test and fix tests setups

* Change `touch` flags descriptions

* Update `touch` example

* Add reference flag to `touch` command

* Add access flag to `touch` command

* Add no-create flag to `touch` command

* Replace `unwrap` with `expect`
2022-04-07 06:44:05 -05:00
Simon Goller
19c3570cf9
Allow open to work with 'from ...' block commands (#5049)
* Remove panic from BlockCommands run function

Instead of panicing, the run method now returns an error to prevent
nushell from unexpected termination.

* Add ability to open command to run with blocks

The open command tries to parse the content of the file
if there is a command called 'from (file ending)'.  This works
fine if the command was 'built in' because the run method doesn't
fail in this case.  It did fail on a BlockCommand, though.

This change will first probe if the command contains a block and
evaluate it, if this is the case.  If there is no block, it will run
the command the same way as before.

* Add test open files with BlockCommands

* Update open.rs

* Adjust file type on open with BlockCommand parser

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
2022-04-02 07:52:32 +13:00
JT
4bb95a880f
let a simple last be a single value (#5060) 2022-04-01 23:12:31 +13:00
Reilly Wood
79182db587
Clean up which/which-support Cargo feature (#5019)
* Rename "which" feature to "which-support"

* Ignore currently broken environment tests
2022-03-29 06:10:43 -05:00
Andrew Barnes
319930a1b9
Add streaming support to save for ExternalStream data (#4985)
* Add streaming support to save for ExternalStream data

Prior to this change, save would collect data from an ExternalStream (data
originating from externals) consuming memory for the full amount of data piped
to it,

This change adds streaming support for ExternalStream allowing saving of
arbitrarily large files and bounding memory usage.

* Remove broken save test

This test passes but not for the right reasons, since this test was
written filename has become a required parameter.  The parser outputs
an error but the test still passes as is checking the original un-mutated
file assuming save has re-written the contents.

This change removes the test.

```
running 1 test
=== stderr
Error: nu::parser::missing_positional (https://docs.rs/nu-parser/0.60.0/nu-parser/enum.ParseError.html#variant.MissingPositional)

  × Missing required positional argument.
   ╭─[source:1:1]
 1 │ open save_test_1/cargo_sample.toml | save
   ·                                          ▲
   ·                                          ╰── missing filename
   ╰────
  help: Usage: save {flags} <filename>

test commands::save::figures_out_intelligently_where_to_write_out_with_metadata ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 515 filtered out; finished in 0.10s
```
2022-03-27 15:39:27 +13:00
JT
19fa41b114
Fix single quote environment values (#4960)
* Fix single quote external values

* Try to fix windows

* fix test

* fix test
2022-03-26 09:14:48 +13:00
JT
91cd1717e9
Add escapes to 'to nuon' (#4964) 2022-03-26 08:35:37 +13:00
JT
12b85beecc
Fix path join on streams (#4959) 2022-03-26 07:46:48 +13:00
JT
4e9c1067fb
Fix 4946 (#4951)
* Fix reject

* test

* clippy
2022-03-25 20:48:01 +13:00
JT
d122827a30
Fix operator precedence parser (#4947) 2022-03-25 16:23:08 +13:00
JT
5d5b02d8dc
Don't assume external ls (#4925) 2022-03-24 16:42:41 +13:00
JT
bd5778fa24
remove the boolean vars (#4879) 2022-03-20 08:12:10 +13:00
JT
b293282e9b
Add insert/update to lists (#4873) 2022-03-19 10:12:54 +13:00
JT
983d115bc0
Add an alias denylist for expansions (#4871) 2022-03-19 08:03:57 +13:00
Darren Schroeder
5a1af4d661
fixed a couple more tests (#4870) 2022-03-18 12:35:28 -05:00
JT
d0cbb2d12c
Allow expanding aliases before keywords, improve hiding (#4858)
* Allow aliasing source

* Add test

* improve hiding

* Finish adding tests

* fix test
2022-03-18 11:35:50 +13:00
JT
0986eefb64
Add insert and update back (#4864) 2022-03-18 06:55:02 +13:00
Darren Schroeder
6700fbeed7
rename update to upsert to mirror what it really does (#4859)
* rename `update` to `upsert` to mirror what it really does

* change to latest reedline and nu-ansi-term
2022-03-16 19:13:34 -05:00
JT
54d9fff4f2
Revert "Alias to keywords (eg source) (#4835)" (#4841)
This reverts commit c023d4111a.
2022-03-13 13:38:16 -07:00
Jakub Žádník
72daf8c64e
Fix reporting of which and $nu.scope (#4836)
* Refactor & fix which

Instead of fetching all definitions / aliases, only show the one that is
visible.

* Fix $nu.scope to show only visible definitions

* Add missing tests file; Rename one which test
2022-03-13 21:32:46 +02:00
JT
c023d4111a
Alias to keywords (eg source) (#4835)
* Allow aliasing source

* Add test
2022-03-13 11:30:37 -07:00
JT
ff3dffd813
Nu glob (#4818)
* Fork glob. Normalise license holder

* Fix more licenses

* unwraps

* bad doc test
2022-03-13 11:30:27 -07:00
JT
355b1d9929
Simplify empty?, improve default (#4797)
* Simplify empty?, improve default

* improve test
2022-03-09 08:46:28 -05:00
JT
fac086c826
Make reduce -n more sensible (#4791) 2022-03-09 05:56:08 -05:00
JT
299fea8538
Fix external extra (#4777)
* Fix empty table from externals

* Fix empty table from externals
2022-03-07 20:17:33 -05:00
JT
0b6b321ad6
More nuon tests, fix table print (#4762) 2022-03-07 08:39:02 -05:00
JT
4f43d75130
Simplify group/window into their own commands (#4760) 2022-03-06 20:01:29 -05:00
Genna Wingert
4aa9a18c63
Allow save to accept a list of strings (#4743) 2022-03-05 15:56:04 -06:00
Genna Wingert
1527b34d9c
Add back --append flag to save command (#4744) 2022-03-05 13:36:58 -06:00
Justin Ma
1157fcf372
fix typo, update some examples and regenerate docs (#4718) 2022-03-04 06:10:09 -06:00
JT
7d0531d270
Add support for escape characters, make nuon a JSON superset (#4706)
* WIP

* Finish adding escape support in strings

* Try to fix windows
2022-03-03 13:14:03 -05:00
Jakub Žádník
d90b7953dd
Use Nushell's PATH in which (#4690)
* Make which use our path instead of std::env

* Unignore which test

* Fix wrong fn signature without which feature
2022-03-03 10:38:31 +02:00
JT
96a1bf5f8d
Experiment: Allow both $true/true and $false/false (#4696)
* Change true/false to keywords

* oops, clippy

* Both kinds of bools

* Add in some boolean variables

* disable py virtualenv test for now
2022-03-02 19:55:03 -05:00
JT
a6a96b29cb
Add binary literals (#4680) 2022-02-28 18:31:53 -05:00
JT
10364c4f22
don't use table compaction in to nuon if not a table (#4671)
* don't use table compaction in to nuon if not a table

* Make a proper nuon conversion test

* more nuon tests
2022-02-28 07:10:02 -05:00
JT
977ef66356
Fix Windows doc comments (#4643)
* WIP windows doc comments

* WIP windows doc comments

* WIP windows doc comments

* actual fix this time
2022-02-25 13:03:39 -05:00
Darren Schroeder
f507613b38
fixed some more tests (#4607) 2022-02-22 11:32:29 -05:00
JT
9888f8f298
Add pipeline redirection support (#4594)
* redirection

* Remove commented-out

* fix tests

* more fixes
2022-02-21 17:22:21 -05:00
Justin Ma
917886f8ad
feat: update: #4518, Add examples for command: hide, history, from yml, def-env, and table (#4581) 2022-02-21 07:52:50 -06:00
Joseph T. Lyons
4f367a59de
Strip trailing whitespace in files (#4575)
* Strip trailing whitespace in rs files

* Strip trailing whitespace in toml files

* Strip trailing whitespace in md files

* Strip trailing whitespace in nu files
2022-02-21 08:38:15 -05:00
Justin Ma
aea4355d04
refactor: change column names from 'Column*' to 'column*' (#4556) 2022-02-19 19:26:47 -05:00
Justin Ma
ac99ac003a
Add example for cd,transpose,detect columns,split column and split row (#4549) 2022-02-19 09:24:48 -06:00
JT
d53eaac7a1
Improve comparison errors (#4541) 2022-02-18 17:11:27 -05:00
Justin Ma
a5f9ad2a43
Add or update examples for some commands (#4521)
* chore: add or update examples for some commands

* chore: code formatting
2022-02-18 07:06:52 -06:00
Jakub Žádník
bccce0ab46
Use overlay ID for module import lookup (#4514)
* Add id to import pattern

* Finish testing importing in a block
2022-02-17 20:58:24 -05:00
JT
f5f9d56c37
Move to a standard kebab/snake style (#4509) 2022-02-17 09:55:17 -05:00
JT
6e733f49bc
Require block params (#4505)
* Require block params

* Improve errors
2022-02-17 06:40:24 -05:00