1
0
mirror of https://github.com/nushell/nushell.git synced 2025-07-06 01:20:59 +02:00
Commit Graph

99 Commits

Author SHA1 Message Date
7dc1d6a350 Extract .nu-env tests and more granularity ()
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
48a90fea70 Fix let-env () 2021-02-15 20:58:51 +13:00
b202951c1d fix prompts on startup ()
* fix prompts on startup

* Try again
2021-02-15 20:14:16 +13:00
b403fb1275 nu-parser + nu-protocol: switch to metric for KB, MB, GB, add KiB, MiB, GiB units ()
fixes inconsistency with formatting/rendering which uses standard Rust byte_unit
https://en.wikipedia.org/wiki/Byte#Multiple-byte_units
2021-02-10 15:31:12 +13:00
44e088c6fe Move filesize to use bigint ()
* Move filesize to be bigint-sized

* Add tests and fix filesize display

* clippy
2021-01-30 11:35:18 +13:00
52dc04a35a Error on bad row in column path ()
* Error on bad row in column path

* Add more pathing tests
2021-01-22 18:14:13 -05:00
a4b8d4a098 Add rest support to blocks () 2021-01-23 10:28:32 +13:00
899d324a9c fix: error Variable not in scope for a def parameter ()
adding tests to notice regressions on this issue

Co-authored-by: hk <alexhaka10@protonmail.com>
2021-01-20 07:21:11 +13:00
99117ff2ef Fix reading/writing bigint and bigdecimal () 2021-01-09 12:53:59 +13:00
17a433996e rename set/set-env to let/let-env () 2021-01-05 12:30:55 +13:00
27fe356214 Add proper shadowing () 2021-01-03 20:48:02 +13:00
fc44df1e45 Don't leak set/set-env/source scopes via actions () 2021-01-03 19:44:21 +13:00
43c10b0625 Properly handle commands defined inside of other commands ()
* Fix function inner scopes

* tweak error
2021-01-01 19:23:54 +13:00
f22938fc4a Add support for custom subcommands ()
* Add support for custom subcommands

* clippy
2020-12-23 20:43:56 +13:00
c012d648fb Add experimental support for flags in custom commands ()
* Add experimental support for flags in custom commands

* clippy
2020-12-21 20:36:59 +13:00
058ef69da3 Add set-env for setting environment variables () 2020-12-19 19:25:03 +13:00
ac578b8491 Multiline scripts part 2 ()
* 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
6951fb440c Remove it expansion ()
* Remove it-expansion, take 2

* Cleanup

* silly update to test CI
2020-10-26 19:55:52 +13:00
2b076369e0 handle duration overflow error ()
* handle duration overflow error

* handle checked_add_signed result
2020-10-09 14:51:47 +13:00
599bb9797d Implement exclusive and inclusive ranges with ..< and .. ()
* Implement exclusive and inclusive ranges with .. and ..=

This commit adds right-exclusive ranges.

The original a..b inclusive syntax was changed to reflect the Rust notation.
New a..=b syntax was introduced to have the old behavior.

Currently, both a.. and b..= is valid, and it is unclear whether it's valid
to impose restrictions.

The original issue suggests .. for inclusive and ..< for exclusive ranges,
this can be implemented by making simple changes to this commit.

* Fix collect tests by changing ranges to ..=

* Fix clippy lints in exclusive range matching

* Implement exclusive ranges using `..<`
2020-09-14 09:53:08 +12:00
d9ae66791a allow decimals as a range boundary () 2020-09-08 05:30:11 +12:00
c9ffd6afc0 Improve range parsing and handling ()
* Improve range parsing and handling

* linting
2020-09-07 14:43:58 +12:00
df691c6c91 Light fixes ()
* Add optional commas for items in lists and tables

* A couple last fixes
2020-08-30 19:03:18 +12:00
abc05ece21 Add optional commas for items in lists and tables () 2020-08-30 18:19:54 +12:00
6f69ae8707 Add table literals ()
* Add table literals

* clippy
2020-08-30 16:55:33 +12:00
57101d5022 Run exitscripts in original dir ()
* Modify testcase

* Run exitscript in the folder it was specified

* Update documentation

* Add comment

* Borrow instead of clone

* Does this just... work on windows?

* fmt

* as_str

* Collapse if by order of clippy

* Support windows

* fmt

* refactor tests

* fmt

* This time it will work on windows FOR SURE

* Remove debug prints

* Comment

* Refactor tests

* fmt

* fix spelling

* update comment
2020-08-18 17:36:09 +12:00
3c18169f63 Autoenv fix: Exitscripts incorrectly running when visiting a subdirectory ()
* Add test case for issue

* Preliminary fix

* fmt

* Reorder asserts

* move insertion

* Touch nu-env.toml

* Cleanup

* touch nu-env toml

* Remove touch

* Change feature flags
2020-08-12 07:54:49 +12:00
d8594a62c2 Add wasm support ()
* 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
80d2a7ee7a Fix autoenv executing scripts multiple times ()
* Fix autoenv executing scripts multiple times

Previously, if the user had only specified entry or exitscripts the scripts
would execute many times. This should be fixed now

* Add tests

* Run exitscripts

* More tests and fixes to existing tests

* Test solution with visited dirs

* Track visited directories

* Comments and fmt
2020-07-15 07:16:50 +12:00
f3f40df4dd Tests for autoenv (and fixes for bugs the tests found) ()
* add test basic_autoenv_vars_are_added

* Tests

* Entry and exit scripts

* Recursive set and overwrite

* Make sure that overwritten vals are restored

* Move tests to autoenv

* Move tests out of cli crate

* Tests help, apparently. Windows has issues

On windows, .nu-env is not applied immediately after running autoenv trust.
You have to cd out of the directory for it to work.

* Sort paths non-lexicographically

* Sibling dir test

* Revert "Sort paths non-lexicographically"

This reverts commit 72e4b856af.

* Rename test

* Change conditions

* Revert "Revert "Sort paths non-lexicographically""

This reverts commit 71606bc62f.

* Set vars as they are discovered

This means that if a parent directory is untrusted,
the variables in its child directories are still set properly.

* format

* Fix cleanup issues too

* Run commands in their separate functions

* Make everything into one large function like all the cool kids

* Refactoring

* fmt

* Debugging windows path issue

* Canonicalize

* Trim whitespace

* On windows, use echo nul instead of touch to create file in test

* Avoid cloning by using drain()
2020-07-12 16:14:09 +12:00
dffc9c9b1c Properly redirect invocations ()
* Properly redirect invocations

* Don't convert with-env yet, as there's a random test failure
2020-06-28 09:04:57 +12:00
4e2a4236f8 Fix it expansion and add collect () 2020-06-27 17:38:19 +12:00
53a6e9f0bd Convert sum command into subcommand of the math command ()
* Convert sum command into subcommand of the math command

* Add bullet points to math.md documentation
2020-06-18 21:02:01 -05:00
98a3d9fff6 Allow echo to iterate ranges () 2020-05-28 06:07:53 +12:00
e2dabecc0b Make it-expansion work when in a list () 2020-05-27 20:29:05 +12:00
bf212a5a3a change the test to use the origin column () 2020-05-25 18:50:54 -04:00
ed80933806 String interpolation ()
* Add string interpolation

* fix coloring

* A few more fixups + tests

* merge master again
2020-05-20 07:27:26 +12:00
ae87582cb6 Fix missing invocation errors () 2020-05-19 08:57:25 -04:00
6efabef8d3 Remove interpretation of Primitive::Nothing as the number 0. () 2020-05-18 15:18:46 -04:00
f18424a6f6 Remove test-bins feature. 2020-05-17 23:32:55 -05:00
f43ed23ed7 Fix parsing of invocations with a dot () 2020-05-16 19:25:18 +12:00
076fde16dd Evaluation of command arguments ()
* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* Finish adding the baseline refactors for argument invocation

* Finish cleanup and add test

* Add missing plugin references
2020-05-16 15:18:24 +12:00
96e5fc05a3 Pick->Select rename. Integration tests changes. ()
Pick->Select rename. Integration tests changes.
2020-05-07 06:03:43 -05:00
a9968046ed Add subcommands. Switch from-* and to-* to them () 2020-05-04 20:44:33 +12:00
73d5310c9c make it-expansion work through blocks when necessary () 2020-04-29 19:51:46 +12:00
18d988d4c8 Restrict short-hand flag detection to exact match. () 2020-02-18 01:58:30 -05:00
84927d52b5 Refuse internal command execution given unexpected arguments. () 2020-02-13 02:34:43 -05:00
3687603799 Only spawn external once when no $it argument () 2020-02-08 17:57:05 -08:00
29431e73c2 Externals now spawn independently. ()
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