Commit Graph

285 Commits

Author SHA1 Message Date
JT
0d7b10fd0b Remove bad fixmes 2021-10-14 17:43:49 +13:00
JT
dcda7a4e50 Touchups to help 2021-10-14 06:58:39 +13:00
JT
fdd2c35fd9 Add the default help flag 2021-10-14 06:53:27 +13:00
JT
6024a001b4 Clarify todo/fixmes 2021-10-13 06:44:23 +13:00
JT
5f14faf4b4 Custom switch support 2021-10-12 17:49:17 +13:00
JT
96419f168b Also fix the flag params 2021-10-12 10:17:45 +13:00
JT
63e3552eef Add the remaining missing operators 2021-10-12 09:35:12 +13:00
JT
38bc394a12 Expose errors early when possible 2021-10-12 07:45:31 +13:00
JT
c3a032950d Add initial batch of into conversions 2021-10-11 14:56:19 +13:00
Arthur Targaryen
9e7e8ed48f Handle not-in operator 2021-10-09 19:40:47 +02:00
Arthur Targaryen
8783cf0138 Add basic in operator support 2021-10-09 19:27:54 +02:00
JT
44fbf0fce3
Merge pull request #108 from nushell/help_and_start_split
Port help and start porting split
2021-10-09 14:07:13 +13:00
JT
4ddc953e38 Port help and start porting split 2021-10-09 14:02:01 +13:00
JT
64d83142c3 More external cleanup 2021-10-09 11:30:10 +13:00
JT
dea9c1482b Allow vars and subexprs in extern args 2021-10-09 10:51:47 +13:00
JT
535ece4e76 Add unit parsing and eval support 2021-10-05 15:27:39 +13:00
JT
a88058006a Add path completions 2021-10-05 08:21:31 +13:00
JT
63a0aa6088 Let strings be cell paths 2021-10-02 18:43:43 +13:00
JT
5843acec02 Add wrap and get and cell_path parsing 2021-10-02 15:59:11 +13:00
JT
c5e9ff5f14 add ps and early help 2021-10-02 10:53:13 +13:00
JT
abb0d7bd22 Add support for module imports 2021-09-27 07:39:19 +13:00
Fernando Herrera
660e8b5b73 external with redirection 2021-09-23 17:42:03 +01:00
Fernando Herrera
29771c7d23 clippy errors 2021-09-20 10:42:03 +01:00
Fernando Herrera
cb0914ecb0 remove enter scope 2021-09-20 10:32:55 +01:00
Fernando Herrera
672dd5a868 external with input 2021-09-19 22:48:33 +01:00
Fernando Herrera
96af23f370 clippy errors 2021-09-19 20:41:35 +01:00
Fernando Herrera
bafc50fd5c external command 2021-09-19 20:29:58 +01:00
Tw
1297499d7a
add command g to switch shell quickly (#4014)
Signed-off-by: Tw <tw19881113@gmail.com>
2021-09-17 10:39:14 +01:00
Jakub Žádník
cc3653cfd9
Path commands: Put column path args behid flag; Allow path join appending without flag (#4008)
* Change path join signature

* Appending now works without flag
* Column path operation is behind a -c flag

* Move column path arg retrieval to a function

Also improves errors

* Fix path join tests

* Propagate column path changes to all path commands

* Update path command examples with columns paths

* Modernize path command examples by removing "echo"

* Improve structured path error message

* Fix typo
2021-09-15 21:03:51 +03:00
Fernando Herrera
1a9247b77f Merge branch 'main' of https://github.com/nushell/engine-q into externals 2021-09-14 07:19:31 +01:00
Fernando Herrera
8f07f40f22 external call 2021-09-12 16:34:43 +01:00
Jakub Žádník
cc5c4d38bb
Small fixes and refactors to paths & source command (#3998)
* Expand path when converting value -> PathBuf

Also includes Tagged<PathBuf>.

Fixes #3605

* Expand path for PATH env. variable

Fixes #1834

* Remove leftover Cows after nu-path refactor

There were some unnecessary Cow conversions leftover from the old
nu-path implementation.

* Use canonicalize in source command; Improve errors

Previously, `source` used `expand_path()` which does not follow
symlinks.

As a follow up, I improved the source error messages so they now tell
why the source file could not be canonicalized or read into string.
2021-09-12 02:36:14 +03:00
Jakub Žádník
4749776984 Add stepping to ranges & enable reverse ranges
Follows the following syntax: <start>..<next-value>..<end>
2021-09-11 14:28:46 +03:00
Marcin Puc
51c74eebd0
Add general refactorings (#3996) 2021-09-10 10:44:22 +12:00
JT
bb6781a3b1 Add row conditions 2021-09-10 09:47:20 +12:00
JT
b0ab78a767 Switch tables to list/streams of records 2021-09-07 19:07:11 +12:00
JT
bdce34676a Allow rest vars to have a custom name 2021-09-07 15:37:02 +12:00
JT
3b7d7861e3 Add cell paths 2021-09-07 10:02:24 +12:00
JT
979faf853a Block params 2021-09-06 14:20:02 +12:00
JT
aaee3a8b61 WIP 2021-09-06 11:16:27 +12:00
Jakub Žádník
f0d469f1d4 Fix clippy warnings 2021-09-05 01:40:15 +03:00
Jakub Žádník
0b412cd6b3 Add support for positive integer ranges
Including support for variables and subexpressions as range bounds.
2021-09-05 00:52:57 +03:00
Tw
ae9f4135c0
support appending when saving file (#3992)
This patch implements `>>` operation in bash.

Signed-off-by: Tw <tw19881113@gmail.com>
2021-09-05 06:12:08 +12:00
JT
5e33b8536b Add discrete list/table 2021-09-04 18:52:28 +12:00
JT
12d80c2732 Fix test 2021-09-03 15:49:14 +12:00
JT
750502c870 Fix up for_in 2021-09-03 14:57:18 +12:00
JT
df63490266 Fix up calls and pipelines 2021-09-03 14:15:01 +12:00
JT
7c8504ea24 Add commands 2021-09-03 10:58:15 +12:00
JT
94687a7603 Back to working state 2021-09-03 06:21:37 +12:00
JT
e1be8f61fc WIP 2021-09-02 20:25:22 +12:00
JT
3d252a9797 Add nu-protocol 2021-09-02 13:29:43 +12:00
JT
c4c4d82bf4 Try putting streams in Value 2021-09-02 09:20:53 +12:00
JT
46d2efca13 Fix table parsing 2021-08-29 07:17:30 +12:00
Jakub Žádník
d95375d494
nu-path crate refactor (#3730)
* Resolve rebase artifacts

* Remove leftover dependencies on removed feature

* Remove unnecessary 'pub'

* Start taking notes and fooling around

* Split canonicalize to two versions; Add TODOs

One that takes `relative_to` and one that doesn't.
More TODO notes.

* Merge absolutize to and rename resolve_dots

* Add custom absolutize fn and use it in path expand

* Convert a couple of dunce::canonicalize to ours

* Update nu-path description

* Replace all canonicalize with nu-path version

* Remove leftover dunce dependencies

* Fix broken autocd with trailing slash

Trailing slash is preserved *only* in paths that do not contain "." or
"..". This should be fixed in the future to cover all paths but for now
it at least covers basic cases.

* Use dunce::canonicalize for canonicalizing

* Alow cd recovery from non-existent cwd

* Disable removed canonicalize functionality tests

Remove unused import

* Break down nu-path into separate modules

* Remove unused public imports

* Remove abundant cow mapping

* Fix clippy warning

* Reformulate old canonicalize tests to expand_path

They wouldn't work with the new canonicalize.

* Canonicalize also ~ and ndots; Unify path joining

Also, add doc comments in nu_path::expansions.

* Add comment

* Avoid expanding ndots if path is not valid UTF-8

With this change, no lossy path->string conversion should happen in the
nu-path crate.

* Fmt

* Slight expand_tilde refactor; Add doc comments

* Start nu-path integration tests

* Add tests TODO

* Fix docstring typo

* Fix some doc strings

* Add README for nu-path crate

* Add a couple of canonicalize tests

* Add nu-path integration tests

* Add trim trailing slashes tests

* Update nu-path dependency

* Remove unused import

* Regenerate lockfile
2021-08-28 15:59:09 +03:00
JT
24cd1b591c Update todo 2021-08-27 14:30:10 +12:00
Hristo Filaretov
b8e2bdd6b1
Allow different names for ...rest (#3954)
* Allow different names for ...rest

* Resolves #3945

* This change requires an explicit name for the rest argument in `WholeStreamCommand`,
  which is why there are so many changed files.

* Remove redundant clone

* Add tests
2021-08-27 05:58:53 +12:00
Hristo Filaretov
88817a8f10
Allow environment variables to be hidden (#3950)
* Allow environment variables to be hidden

This change allows environment variables in Nushell to have a value of
`Nothing`, which can be set by the user by passing `$nothing` to
`let-env` and friends.

Environment variables with a value of Nothing behave as if they are not
set at all. This allows a user to shadow the value of an environment
variable in a parent scope, effectively removing it from their current
scope. This was not possible before, because a scope can not affect its
parent scopes.

This is a workaround for issues like #3920.

Additionally, this allows a user to simultaneously set, change and
remove multiple environment variables via `load-env`. Any environment
variables set to $nothing will be hidden and thus act as if they are
removed. This simplifies working with virtual environments, which rely
on setting multiple environment variables, including PATH, to specific
values, and remove/change them on deactivation.

One surprising behavior is that an environment variable set to $nothing
will act as if it is not set when querying it (via $nu.env.X), but it is
still possible to remove it entirely via `unlet-env`. If the same
environment variable is present in the parent scope, the value in the
parent scope will be visible to the user. This might be surprising
behavior to users who are not familiar with the implementation details.

An additional corner case is the the shorthand form of `with-env` does
not work with this feature. Using `X=$nothing` will set $nu.env.X to the
string "$nothing". The long-form works as expected: `with-env [X
$nothing] {...}`.

* Remove unused import

* Allow all primitives to be convert to strings
2021-08-26 08:15:58 -05:00
JT
35c3622405 Add a few operators. Needs parser work 2021-08-26 07:29:36 +12:00
Hristo Filaretov
6db5692be4
Only allow unaliasing in current scope, add tests (#3936)
* unalias only removes aliases in the current scope

* Add a test and fix previous ones which did not function as expected
2021-08-19 19:05:36 +12:00
soumil-07
9bd408449e
Add the ability to remove and list aliases (#3879)
* Add the ability to remove and list aliases

* Fix failing unit tests

* Add a test to check unalias shadowing blocks
2021-08-17 08:56:35 -05:00
JT
739425431a improve type inference 2021-08-17 12:26:05 +12:00
JT
ceea7e5aeb Remove lifetime from eval state 2021-08-16 14:30:31 +12:00
JT
579814895d Fix up eval params and refactor 2021-08-16 10:33:34 +12:00
JT
1355a5dd33 refactor to subcrates 2021-08-11 06:51:08 +12:00
hedonihilist
c9b87c4c03
Count the size of the directories when calculating the size in DirInfo (#3902)
* take dir entry size into consideration when calculting the size of a directory in DirInfo

* fmt check
2021-08-08 05:50:02 +12:00
JT
b6728efcd4
in/not-in for strings (#3906) 2021-08-07 09:49:37 +12:00
JT
e602647d4d
Fix clippy lint and disable broken lint (#3865) 2021-07-30 08:11:47 +12:00
Fernando Herrera
83b28cad8d
Remove dependencies (#3853)
* nuframe in its own type in UntaggedValue

* Removed eager dataframe from enum

* Dataframe created from list of values

* Corrected order in dataframe columns

* Returned tag from stream collection

* Removed series from dataframe commands

* Arithmetic operators

* forced push

* forced push

* Replace all command

* String commands

* appending operations with dfs

* Testing suite for dataframes

* Unit test for dataframe commands

* improved equality for dataframes

* moving all dataframe operations to protocol
2021-07-27 14:20:06 -05:00
Fernando Herrera
f1ee9113ac
All is a DataFrame (#3812)
* nuframe in its own type in UntaggedValue

* Removed eager dataframe from enum

* Dataframe created from list of values

* Corrected order in dataframe columns

* Returned tag from stream collection

* Removed series from dataframe commands

* Arithmetic operators

* forced push

* forced push

* Replace all command

* String commands

* appending operations with dfs

* Testing suite for dataframes

* Unit test for dataframe commands

* improved equality for dataframes
2021-07-25 22:01:54 +12:00
Darren Schroeder
9a1e1d5b1e
move lang command to $nu (#3720) 2021-07-01 13:09:50 -05:00
Darren Schroeder
008bdfa43f
a new command to query the nushell internals (#3704)
* a new command to query the nushell internals

* added signature

* a little cleanup
2021-06-29 09:27:16 -05:00
JT
6202c67fe8
Fix #3430 (#3693) 2021-06-26 17:38:36 +12:00
Andrés N. Robalino
03c9eaf005
Variable completions. (#3666)
In Nu we have variables (E.g. $var-name) and these contain `Value` types.
This means we can bind to variables any structured data and column path syntax
(E.g. `$variable.path.to`) allows flexibility for "querying" said structures.

Here we offer completions for these. For example, in a Nushell session the
variable `$nu` contains environment values among other things. If we wanted to
see in the screen some environment variable (say the var `SHELL`) we do:

```
> echo $nu.env.SHELL
```

with completions we can now do: `echo $nu.env.S[\TAB]` and we get suggestions
that start at the column path `$nu.env` with vars starting with the letter `S`
in this case `SHELL` appears in the suggestions.
2021-06-23 19:21:39 +12:00
Niklas Jonsson
a8f6a13239
Move path handling to nu-path (#3653)
* fixes #3616
2021-06-20 11:07:26 +12:00
Nathan Thomas
9e39284de9
Add unlet_env command (#3629)
* Add ability to remove env variables

Signed-off-by: nathom <nathanthomas707@gmail.com>

* Implement unlet_env command

Signed-off-by: nathom <nathanthomas707@gmail.com>

* Update parameter description

Signed-off-by: nathom <nathanthomas707@gmail.com>

* Migrate to new filestructure

Signed-off-by: nathom <nathanthomas707@gmail.com>

* Added tests for unlet-env

Signed-off-by: nathom <nathanthomas707@gmail.com>

* Formatting

Signed-off-by: nathom <nathanthomas707@gmail.com>
2021-06-19 15:00:07 +12:00
JT
a74d05061d
Begin directory contrib docs and split commands (#3650)
* Begin directory contrib docs and split commands

* Fix unused import warning
2021-06-19 12:06:44 +12:00
Jakub Žádník
4140834e4c
Remove dir-s/ectories/ectories-support features (#3647) 2021-06-19 11:29:29 +12:00
JT
fe5055cf29
Relax groups and blocks to output at pipeline level (#3643)
* Relax groups and blocks to output at pipeline level

* Fix up tests and add ignore command
2021-06-18 13:04:51 +12:00
JT
d9d956e54f
Fix issue in external subexpression paths (#3642)
* Fix issue in external subexpression paths

* new clippy dropped

* clippy
2021-06-18 07:59:58 +12:00
Darren Schroeder
02bac0a326
fix FlatShape::Garbage's default foreground color (#3634) 2021-06-16 15:43:15 -05:00
Andrés N. Robalino
7c8fb060f1
Extract completions into subcrate. (#3631) 2021-06-16 15:20:01 -05:00
Andrés N. Robalino
7c7e5112ea
Make Nu bootstrap itself from main. (#3619)
We've relied on `clap` for building our cli app bootstrapping that figures out the positionals, flags, and other convenient facilities. Nu has been capable of solving this problem for quite some time. Given this and much more reasons (including the build time caused by `clap`) we start here working with our own.
2021-06-15 17:43:25 -05:00
Sam Bordo
d60d71a697
Begin porting mkdir (#3607)
* Begin porting mkdir

* Addressed comments
2021-06-15 06:57:21 +12:00
JT
de99e35106
Refactor rarely changing engine state into its own struct (#3612)
* WIP

* Finish up EngineState refactor

* Fix Windows calls

* Fix Windows calls

* Fix Windows calls
2021-06-14 15:19:12 +12:00
Darren Schroeder
2846e3f5d9
enable theming of the command line syntax (#3606)
* enable theming of the command line syntax

* added missing flatshape, sorted flatshapes for easier reading.

* sorted flat shapes again and saved it this time

* added sample rwb.json syntax them file to docs
2021-06-11 14:17:43 -05:00
JT
b9ca3b2039
Remove EvaluationContext::from_args (#3604) 2021-06-11 18:35:21 +12:00
JT
8ac572ed27
Make arg eval lazy, remove old arg evaluation code (#3603)
* Remove old argument eval

* Merge main

* fmt

* clippy

* clippy

* clippy
2021-06-11 13:57:01 +12:00
Fernando Herrera
c4163c3621
Series arithmetic (#3602)
* operations with series

* contains operations with series

* Checked division and masked operations
2021-06-11 09:39:51 +12:00
JT
3ae3e3d23d
Further improve arg errors (#3598)
* Further improve arg errors

* Fix note

* Fix note
2021-06-10 20:33:06 +12:00
JT
fc07e849fe
Improve the errors for arg types (#3597) 2021-06-10 18:47:06 +12:00
JT
383e874166
Fix a bunch of future clippy warnings (#3586)
* Fix a bunch of future clippy warnings

* Fix a bunch of future clippy warnings
2021-06-10 07:08:12 +12:00
JT
16faafb7a8
Rename the use of invocation to subexpression (#3568)
* Rename the use of invocation to subexpression

* Fix test name
2021-06-07 20:08:35 +12:00
Jakub Žádník
82d69305b6
Path expand fixes (#3505)
* Throw an error if path failed to expand

Previously, it just repeated the non-expanded path.

* Allow expanding non-existent paths

This commit has a strange error in examples.

* Specify span manually in examples; Add an example

* Expand relative path without requiring cwd

* Remove redundant tilde expansion

This makes the tilde expansion in relative paths dependant on "dirs"
feature.

* Add missing example result

* Adjust path expand description

* Fix import error with missing feature
2021-06-07 05:28:55 +12:00
JT
1d0d0425d4
More fixes for bigint duration (#3557) 2021-06-05 04:54:18 +12:00
JT
4bca36f479
Switch duration back to bigint (#3554) 2021-06-04 19:39:12 +12:00
JT
131b5b56d7
Finish removing arg deserialization (#3552)
* WIP remove process

* WIP

* WIP

* Finish removing arg deserialization
2021-06-04 18:23:57 +12:00
JT
290c712cde
Retain tag when accessing a var (#3535) 2021-06-02 19:49:14 +12:00
Lily Mara
4b11b283ac
Resolve issues with rm * globbing (#3516)
Using the `*` wildcard should not attempt to delete files with a leading dot
unless the more explicit `.*` is used. `rm *` should also not attempt to delete
the current directory or its parent directory (`.` and `..`). I have resolved
this bug as well in a less satisfactory way. I think it may be the case that we
can only disambiguate the `.` and `..` path segments by using `Path::display`.
Here is a short list of alternatives that I tried:

- `Path::ends_with()` can detect `/..` but not `/.`.
- `Path::iter()` and `Path::components()` leave out `/.`.
- `Path::file_name()` normalizes `/.` to the parent component's file name.

Fixes #3508
2021-05-30 15:36:36 +12:00
JT
41834d16d6
Allow aliases to expand and ignore painting outside of lines (#3492) 2021-05-26 17:58:32 +12:00
JT
5fcc7f2328
Fix bad operator (#3479) 2021-05-24 17:27:10 +12:00
JT
20f6114617
Improve block params (#3450) 2021-05-20 16:26:54 +12:00
Jakub Žádník
3075e2cfbf
Remove rest_args() from evaluated CommandArgs (#3449)
It was too error prone when positional arguments were used with the rest
arguments. Now, you need to explicitly state from which position you
want to count the rest args (e.g., `rest(0)`).
2021-05-20 10:26:23 +12:00
JT
e2973d2176
Add explicit block params (#3444)
* Add explicit block params

* Add explicit block params
2021-05-19 20:23:45 +12:00
JT
d79a3130b8
Make the default int an i64 (#3428)
* Make the default int an i64

* fmt

* Fix random integer

* Treat pids as i64 for now
2021-05-14 20:35:09 +12:00
Darren Schroeder
440a589f9e changed comment slightly 2021-05-13 14:21:16 -05:00
JT
9b8b1bad57
Don't insert PATH variable on Windows (#3422)
* Don't insert PATH variable on Windows

* Simplify fix

* Just centralize the var

* Add a message about why we have to workaround the issue
2021-05-13 15:03:49 +12:00
JT
3aa00b78f9
Improve missing var in var-path error (#3415) 2021-05-12 20:53:34 +12:00
JT
25a8caa9b0
Simplify expressions (#3389)
* WIP: experiment with simpler expressions

* fix simple invoke

* update tests

* fix a few tests

* Make paren parsing more robust

* fix external args

* Remove old invocation

* Update tests

* Update tests
2021-05-12 13:01:48 +12:00
Jakub Žádník
7a583083b8
Convert the rest of "random" subcommands to engine-p (#3399)
* Convert "random bool" to engine-p

Also implements FromValue for Tagged<BigDecimal> and Tagged<f64>.

* Convert "random dice" to engine-p

* Convert "random uuid" to engine-p

* Covert "random chars" to engine-p

* Convert "random" command to engine-p
2021-05-10 19:07:57 +12:00
Jakub Žádník
9fd6923821
Port random integer & decimal to engine-p + related refactoring (#3393)
* Implement minmax for Range; Simplify range command

* Port random integer to enginep; New FromValue impl

Now, FromValue is implemented for Tagged<Range> to allow extracting args
into this type.

* Make sure range value extraction fails properly

The range endpoint extraction methods now return error instead of
silently clipping the value. This now makes `random integer ..-4` fail
properly since -4 can't be cast as u64.

* Port random decimal to enginep & Refactor

This added a way to interpret Range limits as f64 and a Primitive helper
to get its value as f64.

A side effect of this commit is that it is now possible to specify the
command bounds as true decimals. E.g., `random decimal 0.0..3.14` does
not clip 3.14 to 3.
2021-05-08 07:58:12 +12:00
JT
91a929b2a9
Clippy fixes for new Rust version (#3392) 2021-05-07 07:58:21 +12:00
JT
fc59291191
Simplify down to one type of context (#3379)
* Simplify down to one type of context

* More simplification
2021-05-03 11:45:55 +12:00
Jakub Žádník
4fc05cac56
Port range to engine-p (#3377)
* Removes arg serialization
* action stream -> output stream
* uses nu_protocol::Range instead of NumericRange
* random missing newline I found in the code
2021-05-03 07:47:59 +12:00
Leonhard Kipp
d05c48a1d7
Fix #3231: Pick up nu-env if cd with shortcuts (#3344)
* Fix autoenv not set when using implied cd

* Fix wrong return value

* Fix windows no value returned err
2021-04-28 17:31:22 +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
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
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
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
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
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
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
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
Andrés N. Robalino
a7274115d0
make Table, Autoview read in memory config. (#3287) 2021-04-08 17:31:19 -05:00
Jonathan Turner
81160bcefb
Remove some clones and improve when autoview reads config (#3285) 2021-04-09 07:47:41 +12:00
Andrés N. Robalino
2880109f31
Runnable contexts move. (#3283)
* Engine extract first steps.

* Don't depend on ShellManager.
2021-04-08 13:51:12 -05:00
Jonathan Turner
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
Jonathan Turner
073e5727c6
Switch to "engine-p" (#3270)
* WIP

* WIP

* first builds

* Tests pass
2021-04-06 11:19:43 -05:00
Andrés N. Robalino
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
Andrés N. Robalino
1c941557c3
Remove unused help shell. Slight cleanup and improvement. (#3258) 2021-04-03 18:56:46 -05:00
Leonhard Kipp
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
Waldir Pimenta
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
Saeed Rasooli
e737222a5d
fix lack of auto-suggestion for aliases (#3249) 2021-04-03 10:39:30 +13:00
Leonhard Kipp
f03f1949bf
Logs and tests (#3247)
* Add command name to err

* Add var name to error message

* Add test for def comment in test
2021-04-01 17:09:33 -05:00
Leonhard Kipp
b13202bbfc
Fix #3244: Add tag reloaded frame (#3246) 2021-04-01 16:25:26 -05:00
Luccas Mateus
90fae903ce
Fixes error when trying to delete a FIFO (#3235)
* Output error when ls into a file without permission

* added test to check fails when ls into prohibited dir

* fix lint

* trigger wasm build

* be able to remove fifos

* Update filesystem_shell.rs

* I thought windows had fifos

* fixed unix and windows conditional compilation

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2021-04-01 06:10:40 +13:00
Luccas Mateus
419a0665c8
Output error when ls into a file without permission (#3218)
* Output error when ls into a file without permission

* added test to check fails when ls into prohibited dir

* fix lint

* trigger wasm build

* Update filesystem_shell.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2021-03-31 19:52:39 +13:00
Leonhard Kipp
c42b588782
Refactor nu-cli/env* (#3041)
* Revert "History, more test coverage improvements, and refactorings. (#3217)"

This reverts commit 8fc8fc89aa.

* Add tests

* Refactor .nu-env

* Change logic of Config write to logic of read()

* Fix reload always appends to old vars

* Fix reload always takes last_modified of global config

* Add reload_config in evaluation context

* Reload config after writing to it in cfg set / cfg set_into

* Add --no-history to cli options

* Use --no-history in tests

* Add comment about maybe_print_errors

* Get ctrl_exit var from context.global_config

* Use context.global_config in command "config"

* Add Readme in engine how env vars are now handled

* Update docs from autoenv command

* Move history_path from engine to nu_data

* Move load history out of if

* No let before return

* Add import for indexmap
2021-03-31 18:52:34 +13:00