Commit Graph

139 Commits

Author SHA1 Message Date
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
Jonathan Turner
06b154f4b2
Bump to 0.29.1 (#3232)
* Bump to 0.29.1

* fix test
2021-03-31 20:13:40 +13:00
Jonathan Turner
4faaa5310e
Bump to 0.29 (#3230)
* Bump to 0.29

* fix test
2021-03-30 22:35:21 +13:00
Andrés N. Robalino
8fc8fc89aa
History, more test coverage improvements, and refactorings. (#3217)
Improvements overall to Nu. Also among the changes here, we can also be more confident towards incorporating `3041`. End to end tests for checking envs properly exported to externals is not added here (since it's in the other PR)

A few things added in this PR (probably forgetting some too)

* no writes happen to history during test runs.
* environment syncing end to end coverage added.
* clean up / refactorings few areas.
* testing API for finer control (can write tests passing more than one pipeline)
* can pass environment variables in tests that nu will inherit when running.

* No longer needed.

* no longer under a module. No need to use super.
2021-03-27 00:08:03 -05:00
Jonathan Turner
7e184b58b2
Fix warnings for Rust 1.51 (#3214)
* Fix warnings for Rust 1.51

* More fixes

* More fixes
2021-03-26 21:26:57 +13:00
Andrés N. Robalino
d2213d18fa
Playground infraestructure (tests, etc) additions. (#3179)
* Playground infraestructure (tests, etc) additions.

A few things to note:

* Nu can be started with a custom configuration file (`nu --config-file /path/to/sample_config.toml`). Useful for mocking the configuration on test runs.
* When given a custom configuration file Nu will save any changes to the file supplied appropiately.
* The `$nu.config-path` variable either shows the default configuration file (or the custom one, if given)
* We can now run end to end tests with finer grained control (currently, since this is baseline work, standard out) This will allow to check things like exit status, assert the contents with a format, etc)

* Remove (for another PR)
2021-03-15 02:26:30 -05:00
nibon7
82b6300dcb
fix: cargo test failed with --release (#3183) (#3184)
Signed-off-by: nibon7 <nibon7@163.com>
2021-03-15 16:59:04 +13:00
Jonathan Turner
22ae962b57
Bump to 0.28 (#3149) 2021-03-09 23:40:17 +13:00
Andrés N. Robalino
0b71e45072
Preserve order when serializing/deserialize json by default. (#3126) 2021-03-04 01:35:13 -05:00
Jonathan Turner
aa6c6120f6
Bump to 0.27.2 (#3109)
* Bump to 0.27.2

* Fix clippy and test
2021-02-26 17:55:25 +13:00
Andrés N. Robalino
7dc1d6a350
Extract .nu-env tests and more granularity (#3078)
The autoenv logic mutates environment variables in the running session as
it operates and decides what to do for trusted directories containing `.nu-env`
files. Few of the ways to interact with it were all in a single test function.

We separate out all the ways that were done in the single test function to document
 it better. This will greatly help once we start refactoring our way out from setting
 environment variables this way to just setting them to `Scope`.

This is part of an on-going effort to keep variables (`PATH` and `ENV`)
in our `Scope` and rely on it for everything related to variables.

We expect to move away from setting (`std::*`) envrironment variables in the current
running process. This is non-trivial since we need to handle cases from vars
coming in from the outside world, prioritize, and also compare to the ones
we have both stored in memory and in configuration files.

Also to send out our in-memory (in `Scope`) variables properly to external
programs once we no longer rely on `std::env` vars from the running process.
2021-02-18 20:24:27 -05:00
Jonathan Turner
deff1aa63b
Bump to 0.27.1 (#3073) 2021-02-18 18:54:48 +13:00
Jonathan Turner
039f223b53
Bump to 0.27 (#3063) 2021-02-16 19:20:05 +13:00
Jonathan Turner
6f17662a4e
Update some deps (#3011) 2021-02-06 09:54:54 +13:00
Jonathan Turner
c83aea3c89
Bump to 0.26.1 (#3008) 2021-02-05 19:38:04 +13:00
Jonathan Turner
388973e9ab
Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
Jonathan Turner
7d07881d96
Bump to 0.25.2 (#2908) 2021-01-12 07:50:53 +13:00
Jonathan Turner
5e72b2a797
Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
Jonathan Turner
d297199d7c
Bump to 0.25.0 (#2860) 2021-01-05 18:10:24 +13:00
Jonathan Turner
ac578b8491
Multiline scripts part 2 (#2795)
* Begin allowing comments and multiline scripts.

* clippy

* Finish moving to groups. Test pass

* Keep going

* WIP

* WIP

* BROKEN WIP

* WIP

* WIP

* Fix more tests

* WIP: alias starts working

* Broken WIP

* Broken WIP

* Variables begin to work

* captures start working

* A little better but needs fixed scope

* Shorthand env setting

* Update main merge

* Broken WIP

* WIP

* custom command parsing

* Custom commands start working

* Fix coloring and parsing of block

* Almost there

* Add some tests

* Add more param types

* Bump version

* Fix benchmark

* Fix stuff
2020-12-18 20:53:49 +13:00
Jonathan Turner
5183fd25bb
Bump version (#2792) 2020-12-16 09:13:18 +13:00
Jonathan Turner
a30837298d
Bump version (#2791) 2020-12-16 06:30:50 +13:00
Stan Zhang
83c874666a
Date utility commands (#2780)
* updated & added date related commands based on the new design

* added proper error handling when date format string is invalid

* fixed format issue

* fixed an issue caused due to the change in primitive Date type

* added `date list-timezone` command to list all supported time zones and updated `date to-timezone` accordingly
2020-12-12 12:18:03 -06:00
Jonathan Turner
e299e76fcf
Bump to 0.23 (#2766) 2020-11-25 07:22:27 +13:00
Jonathan Turner
cb8491cfee
Bump to 0.22 (#2726) 2020-11-04 07:31:41 +13:00
Jonathan Turner
a6fdee4a51
bump to 0.21.1 (#2702)
* bump to 0.21.1

* bump trash version
2020-10-26 21:10:06 +13:00
Andrés N. Robalino
b6d19cc9fa
Move command changes. Refactorings. (#2683)
Continuing on anchoring and improvements on Nu's overall internal commands (#2635).
`move column` sub command has been turned into the command `move` since
we use it to move exclusively columns. Examples added as well.

Fixed it to carry along any anchor locations that might be in place if
table to be moved originates from other sources.
2020-10-20 04:07:13 -05:00
Andrés N. Robalino
791e07650d
ColumnPath creation flexibility. (#2674) 2020-10-15 17:25:17 -05:00
Chris Gillespie
808fe496a6
Fix typo in test support crate description (#2669) 2020-10-14 04:45:32 -05:00
Jonathan Turner
770e5d89f2
Bump to 0.21 (#2663) 2020-10-14 06:19:09 +13:00
Chris Gillespie
38bdb053d2
Add tests for get_data_by_key (#2658)
* Add test for get_data_by_key

* Apply same order for ValuExt impl

* Nothing helper for tests

* Use get_data_by_key from ValueExt
2020-10-12 22:46:58 -05:00
Andrés N. Robalino
973a8ee8f3
Allow config to work with column paths. (#2653)
Nu has many commands that allow the nuño to customize behavior such
as UI and behavior. Today, coloring can be customized, the line editor,
and other things. The more options there are, the higher the complexity
in managing them.

To mitigate this Nu can store configuration options as nested properties.

But to add and edit them can be taxing. With column path support we can
work with them easier.
2020-10-08 20:04:19 -05:00
Jonathan Turner
ebba89ea31
Bump to 0.20 (#2588) 2020-09-22 19:54:46 +12:00
Andrés N. Robalino
0178b53289
Core nu plugin load capability. (#2544)
We introduce the `plugin` nu sub command (`nu plugin`) with basic plugin
loading support. We can choose to load plugins from a directory. Originally
introduced to make integration tests faster (by not loading any plugins on startup at all)
but `nu plugin --load some_path ; test_pipeline_that_uses_plugins_just_loaded` does not see it.

Therefore, a `nu_with_plugins!` macro for tests was introduced on top of nu`s `--skip-plugins`
switch executable which is set to true when running the integration tests that use the `nu!` macro now..
2020-09-14 09:07:02 -05:00
Darren Schroeder
a63a5adafa
remove unused dependencies (#2520)
* remove unused dependencies

* moved umask to cfg(unix)

* changed Inflector to inflector, hoping it fixes the issue.

* roll back Inflector

* removed commented out deps now that everything looks good.
2020-09-09 13:57:51 -05:00
Darren Schroeder
2eb4f8d28a
updated dependencies (#2517) 2020-09-09 10:35:45 +12:00
Jonathan Turner
882cf74137
Bump to 0.19.0 (#2483) 2020-09-02 15:37:06 +12:00
Jonathan Turner
da4d24d082
Bump to 0.18.2. Move starship external. (#2345)
* Bump to 0.18.2. Move starship external.

* Fix failing test
2020-08-14 07:02:45 +12:00
Jonathan Turner
87d71604ad
Bump to 0.18.1 (#2335) 2020-08-12 15:59:28 +12:00
Jonathan Turner
2ad07912d9
Bump to 0.18 (#2325) 2020-08-11 18:44:53 +12:00
Jonathan Turner
ba81278ffd
Remove build.rs and nu-build (#2282) 2020-08-01 09:21:10 +12:00
Jonathan Turner
2a084fc838
Bump to 0.17.0 (#2237) 2020-07-22 06:41:49 +12:00
Jonathan Turner
d8594a62c2
Add wasm support (#2199)
* Working towards a PoC for wasm

* Move bson and sqlite to plugins

* proof of concept now working

* tests are green

* Add CI test for --no-default-features

* Fix some tests

* Fix clippy and windows build

* More fixes

* Fix the windows build

* Fix the windows test
2020-07-18 13:59:23 +12:00
Arash Outadi
97cedeb324
Fix str --to-int usages (#2167) 2020-07-13 15:07:34 -04:00
Jonathan Turner
d30c40b40e
Bump to 0.16.1 (#2116) 2020-07-06 08:12:44 +12:00
Jonathan Turner
0522023d4c
Bump to 0.16.0 (#2084) 2020-07-01 06:25:09 +12:00
Jonathan Turner
7fed9992c9
Bump deps and touchup (#2066) 2020-06-27 19:54:31 +12:00
Joseph T. Lyons
53a6e9f0bd
Convert sum command into subcommand of the math command (#2004)
* Convert sum command into subcommand of the math command

* Add bullet points to math.md documentation
2020-06-18 21:02:01 -05:00
Jonathan Turner
29ea29261d
Bump to 0.15.1 (#1984) 2020-06-15 09:54:30 +12:00
Jonathan Turner
e5a18eb3c2
Bump to 0.15.0 (#1955) 2020-06-10 05:33:59 +12:00
Jason Gedge
6efabef8d3
Remove interpretation of Primitive::Nothing as the number 0. (#1836) 2020-05-18 15:18:46 -04:00
Andrés N. Robalino
f18424a6f6 Remove test-bins feature. 2020-05-17 23:32:55 -05:00
Jonathan Turner
0abc94f0c6
Bump some of our dependencies (#1809) 2020-05-17 10:34:10 +12:00
Xavier L'Heureux
5fbe5cf785
Use the directories crate instead of app_dirs (#1782)
The app_dirs crate is abandonned since quite a bit of time. Use the directories
crate instead, which is maintained and have more OS support.
2020-05-14 20:17:23 +12:00
Jonathan Turner
196991ae1e
Bump to 0.14.1 (#1772) 2020-05-13 20:03:45 +12:00
Jonathan Turner
b2eecfb110
Bump to 0.14 (#1766) 2020-05-13 04:32:51 +12:00
Andrés N. Robalino
96e5fc05a3
Pick->Select rename. Integration tests changes. (#1725)
Pick->Select rename. Integration tests changes.
2020-05-07 06:03:43 -05:00
Kevin Del Castillo
846a779516
Fix cd'ing to symlinked directories (#1651)
* fix: absolutize path against its parent if it was a symlink.

On Linux this happens because Rust calls readlink but doesn't canonicalize the resultant path.

* feat: playground function to create symlinks

* fix: use playground dirs

* feat: test for #1631, shift tests names
2020-04-25 18:09:00 +12:00
Jonathan Turner
c7e11a5a28
bump to 0.13.0 (#1625) 2020-04-21 17:01:03 +12:00
Jonathan Turner
e4fdb36511
External vars (#1615)
* fix empty table and missing spans

* wip

* WIP

* WIP

* working version with vars

* tidying

* WIP

* Fix external quoting issue
2020-04-21 09:45:11 +12:00
Jonathan Turner
08a09e2273
Pipeline blocks (#1579)
* Making Commands match what UntaggedValue needs

* WIP

* WIP

* WIP

* Moved to expressions for conditions

* Add 'each' command to use command blocks

* More cleanup

* Add test for 'each'

* Instead use an expression block
2020-04-13 19:59:57 +12:00
Jonathan Turner
04702530a3
Bump a lot of deps (#1560) 2020-04-07 19:51:17 +12:00
Jonathan Turner
c4daa2e40f
Add experimental new parser (#1554)
Move to an experimental new parser
2020-04-06 19:16:14 +12:00
Jonathan Turner
791f7dd9c3
Bump to 0.12.0 (#1538) 2020-04-01 06:25:21 +13:00
Jon Grythe Stødle
a5e97ca549
Respect CARGO_TARGET_DIR when set (#1528)
This makes the `binaries` function respect the `CARGO_TARGET_DIR` environment variable when set. If it's not present it falls back to the regular target directory used by Cargo.
2020-03-27 17:13:59 -04:00
Jonathan Turner
62666bebc9
Bump to 0.11.0 (#1474) 2020-03-11 06:34:19 +13:00
Jason Gedge
b2c5af457e
Move most of the root package into a subcrate. (#1445)
This improves incremental build time when working on what was previously
the root package. For example, previously all plugins would be rebuilt
with a change to `src/commands/classified/external.rs`, but now only
`nu-cli` will have to be rebuilt (and anything that depends on it).
2020-03-04 13:58:20 -05:00
Jason Gedge
7304d06c0b
Use threads to avoid blocking reads/writes in externals. (#1440)
In particular, one thing that we can't (properly) do before this commit
is consuming an infinite input stream. For example:

```
yes | grep y | head -n10
```

will give 10 "y"s in most shells, but blocks indefinitely in nu. This PR
resolves that by doing blocking I/O in threads, and reducing the `await`
calls we currently have in our pipeline code.
2020-03-02 06:19:09 +13:00
Jonathan Turner
0f7c723672
Bump version to 0.10.0 (#1403) 2020-02-18 16:56:09 +13:00
Jason Gedge
a29d52158e
Do not panic when failing to decode lines from external stdout (#1364) 2020-02-10 07:37:48 -08:00
Jason Gedge
3687603799
Only spawn external once when no $it argument (#1358) 2020-02-08 17:57:05 -08:00
Shaurya Shubham
49a1385543
Make tests work from directory names with spaces (#1325) 2020-01-31 22:12:56 -08:00
Jonathan Turner
407f36af29
Remove unused dep (#1298) 2020-01-29 16:44:03 +13:00
Jonathan Turner
763fcbc137
Bump to 0.9.0 (#1297) 2020-01-29 15:17:02 +13:00
Andrés N. Robalino
caa6830184
Baseline environment and configuration work. (#1287) 2020-01-27 22:13:22 -05:00
Jonathan Turner
2b37ae3e81
Switch to using subprocess::shell (#1264)
* Switch to using `shell`

Switch to using the shell for subprocess to enable more natural shelling out.

* Update external.rs

* This is a test with .shell() for external

* El pollo loco's PR

* co co co

* Attempt to fix windows

* Fmt

* Less is more?

Co-authored-by: Andrés N. Robalino <andres@androbtech.com>
2020-01-24 05:21:05 +13:00
Andrés N. Robalino
3c01526869
Test binaries no longer belong to stable or default features. (#1259) 2020-01-21 22:00:27 -05:00
Yehuda Katz
7efb31a4e4 Restructure and streamline token expansion (#1123)
Restructure and streamline token expansion

The purpose of this commit is to streamline the token expansion code, by
removing aspects of the code that are no longer relevant, removing
pointless duplication, and eliminating the need to pass the same
arguments to `expand_syntax`.

The first big-picture change in this commit is that instead of a handful
of `expand_` functions, which take a TokensIterator and ExpandContext, a
smaller number of methods on the `TokensIterator` do the same job.

The second big-picture change in this commit is fully eliminating the
coloring traits, making coloring a responsibility of the base expansion
implementations. This also means that the coloring tracer is merged into
the expansion tracer, so you can follow a single expansion and see how
the expansion process produced colored tokens.

One side effect of this change is that the expander itself is marginally
more error-correcting. The error correction works by switching from
structured expansion to `BackoffColoringMode` when an unexpected token
is found, which guarantees that all spans of the source are colored, but
may not be the most optimal error recovery strategy.

That said, because `BackoffColoringMode` only extends as far as a
closing delimiter (`)`, `]`, `}`) or pipe (`|`), it does result in
fairly granular correction strategy.

The current code still produces an `Err` (plus a complete list of
colored shapes) from the parsing process if any errors are encountered,
but this could easily be addressed now that the underlying expansion is
error-correcting.

This commit also colors any spans that are syntax errors in red, and
causes the parser to include some additional information about what
tokens were expected at any given point where an error was encountered,
so that completions and hinting could be more robust in the future.

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
Co-authored-by: Andrés N. Robalino <andres@androbtech.com>
2020-01-21 17:45:03 -05:00
Andrés N. Robalino
29431e73c2
Externals now spawn independently. (#1230)
This commit changes the way we shell out externals when using the `"$it"` argument. Also pipes per row to an external's stdin if no `"$it"` argument is present for external commands. 

Further separation of logic (preparing the external's command arguments, getting the data for piping, emitting values, spawning processes) will give us a better idea for lower level details regarding external commands until we can find the right abstractions for making them more generic and unify within the pipeline calling logic of Nu internal's and external's.
2020-01-16 04:05:53 -05:00
Andrés N. Robalino
78a644da2b
Restrict Nu with a cleaned environment. (#1222) 2020-01-13 23:17:20 -05:00
Andrés N. Robalino
29fd8b55fb
Keep dummies in default features for convenience. (#1212) 2020-01-13 01:17:56 -05:00
Andrés N. Robalino
d3dae05714
Groundwork for coverage with Nu internals. (#1205) 2020-01-12 16:44:22 -05:00
Andrés N. Robalino
0dcd90cb8f
Silence stdout for test runs. (#1198) 2020-01-12 04:14:10 -05:00
Jonathan Turner
02d0a4107e
A few ls improvements. New welcome message (#1195) 2020-01-12 09:49:20 +13:00
Jonathan Turner
41ebc6b42d
Bump to 0.8.0 (#1166) 2020-01-07 20:08:31 +13:00
Jonathan Turner
5919c6c433
Remove unwraps (#1153)
* Remove a batch of unwraps

* finish another batch
2020-01-04 10:11:21 +13:00
Jonathan Turner
72838cc083
Move to using clippy (#1142)
* Clippy fixes

* Finish converting to use clippy

* fix warnings in new master

* fix windows

* fix windows

Co-authored-by: Artem Vorotnikov <artem@vorotnikov.me>
2019-12-31 20:36:08 +13:00
Andrés N. Robalino
0615adac94
Inc refactoring, Value helper test method extractions, and more integration helpers. (#1135)
* Manifests check. Ignore doctests for now.

* We continue with refactorings towards the separation of concerns between
crates. `nu_plugin_inc` and `nu_plugin_str` common test helpers usage
has been refactored into `nu-plugin` value test helpers.

Inc also uses the new API for integration tests.
2019-12-29 00:17:24 -05:00
Jonathan Turner
08571392e6 Rename test-support to nu-test-support 2019-12-18 07:41:47 +13:00