Commit Graph

499 Commits

Author SHA1 Message Date
Herlon Aguiar
5ff2ae628b
nu-cli: directory syntax shape + completions (#5299) 2022-04-22 15:18:51 -05:00
JT
ee29a15119
Add 'and' and 'or' operators (#5297) 2022-04-23 07:14:31 +12:00
JT
76079d5183
Move config to be an env var (#5230)
* Move config to be an env var

* fix fmt and tests
2022-04-19 10:28:01 +12:00
Herlon Aguiar
dd1d9b7623
nu-cli/completions: completion for use and source (#5210)
* nu-cli/completions: completion for use and source

* handle subfolders for different base dirs

* fix clippy errors
2022-04-19 00:59:13 +12:00
Hristo Filaretov
0a990ed105
Simplify known external name recovery (#5213)
Prior to this change we would recover the names for known
externals by looking up the span in the engine state. This would fail
when using an alias for two reasons:

1. In cases where we don't have a subcommand, like this:

```
>>> extern bat [filename: string]
>>> alias b = bat
>>> bat some_file
'b' is not recognized as an internal or external command,
operable program or batch file.
```

The problem is that after alias expansion, we replace the span of the
expanded name with the original alias (this is done to alleviate
non-related issues). The span contents we look up therefore contain `b`,
the alias, instead of the expanded command name.

2. In cases where there's a subcommand:
```
>>> alias g = git
>>> g push
thread 'main' panicked at 'internal error: span missing in file contents cache', crates\nu-protocol\src\engine\engine_state.rs:474:9
note: run with `RUST_BACKTRACE=1` environment variable to display a
backtrace
```

In this case, the span in call starts where the expansion for the `g`
alias is defined and end after `push` on the last command entered. This
is not a proper span and causes a panic when we try to look it up. Note
that this is the case for all expanded aliases that involve a
subcommand, but we never actually try to retrieve the contents for that
span in other cases.

Anyway, the new way of looking up the name is arguably cleaner
regardless of the issues mentioned above. But it's nice that it fixes
them too.

Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
2022-04-16 22:07:38 -05:00
Tomoki Aonuma
c17129a92a
Fix env capture (#5205)
* Fix env capture

* Add test for env capture
2022-04-16 10:38:27 +12:00
merkrafter
a30930324d
Support binary literals with binary format (#5149)
* 4924 Support binary literals with binary format

* 4924 Support automatic padding for binary literals
2022-04-11 19:58:57 +12:00
JT
14066ccc30
Fix known externals, fix operator spans (#5140) 2022-04-09 17:17:48 +12:00
Hristo Filaretov
683b912263
Track call arguments in a single list (#5125)
* Initial implementation of ordered call args

* Run cargo fmt

* Fix some clippy lints

* Add positional len and nth

* Cargo fmt

* Remove more old nth calls

* Good ole rustfmt

* Add named len

Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
2022-04-09 14:55:02 +12:00
JT
97eb8492a3
Improve $in handling (#5137)
* Simplify in logic

* Add tests

* more tests, and fixes
2022-04-09 09:41:05 +12:00
JT
0b85938415
Soften the block arity checking (#5135) 2022-04-09 07:57:27 +12:00
Reilly Wood
b2c52b51b7
Change string contains operators to regex (#5117) 2022-04-07 18:23:14 +12:00
JT
888369022f
Add datetime to math-like (#5118)
* Add datetime to math-like

* add test
2022-04-07 18:02:28 +12:00
JT
4409185e1b
Improve describe to be more accurate (#5116) 2022-04-07 16:34:09 +12:00
JT
ef1934a7ee
Remove external name exceptions (#5115) 2022-04-07 14:01:31 +12:00
JT
591fb4bd36
Add unary not (#5111) 2022-04-07 07:10:25 +12:00
Herlon Aguiar
13869e7d52
nu-cli: refactor completions (#5102) 2022-04-06 19:58:55 +12:00
JT
abe028f930
Add raw strings, use raw strings for env (#5090) 2022-04-05 08:42:26 +12:00
JT
6649da3f5d
Add support for single value row conditions (#5072) 2022-04-03 10:41:36 +12:00
Darren Schroeder
2cb815b7b4
Add starts with operator (#5061)
* add starts_with operator

* added a test
2022-04-01 13:35:46 -05:00
Jakub Žádník
d89ad4fafd
Add record, list, and table to signature types (#5040) 2022-03-31 11:11:03 +03:00
Reilly Wood
31a4fc41eb
Fix env var shorthand when value contains = (#5022) 2022-03-30 09:56:55 +13:00
JT
cf88c8eef3
Improve escaping in string interpolation (#4982) 2022-03-27 12:52:09 +13:00
JT
66087b01e6
Improve the 'use' and 'source' errors (#4966)
* Improve the 'use' and 'source' errors

* Add register
2022-03-26 10:43:46 +13:00
JT
d122827a30
Fix operator precedence parser (#4947) 2022-03-25 16:23:08 +13:00
Tomoki Aonuma
90013295aa
Fix parse_string_strict() to detect unbalanced quotes properly (#4928) 2022-03-25 05:57:03 +13:00
JT
66e736dab4
Externals shouldn't expand aliases (#4889) 2022-03-22 11:57:48 +13:00
JT
bd5778fa24
remove the boolean vars (#4879) 2022-03-20 08:12:10 +13:00
JT
f3bb1d11d3
Add export alias and export extern (#4878)
* export alias

* export extern
2022-03-20 07:58:01 +13:00
JT
983d115bc0
Add an alias denylist for expansions (#4871) 2022-03-19 08:03:57 +13:00
JT
7773c4cd4d
Fix single quote external interpolation (#4867) 2022-03-18 19:59:28 +13: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
0bd8664f33
Fix string interpolation escaping (#4854) 2022-03-16 05:09:30 +13:00
JT
54d9fff4f2
Revert "Alias to keywords (eg source) (#4835)" (#4841)
This reverts commit c023d4111a.
2022-03-13 13:38:16 -07:00
JT
c023d4111a
Alias to keywords (eg source) (#4835)
* Allow aliasing source

* Add test
2022-03-13 11:30:37 -07:00
Jakub Žádník
c73d8d5f95
Add LIB_DIRS and PLUGIN_DIRS (#4829)
* Add LIB_DIRS and PLUGIN_DIRS

* Put plugin dirs behind plugin feature
2022-03-12 22:12:15 +02:00
JT
12bf23faa6
Move completions to DeclId (#4801)
* Move completions to DeclId

* fmt

* fmt
2022-03-10 09:49:02 +02:00
JT
3bdd924349
Fixes the panic when using externs + string interpolation (#4799) 2022-03-09 13:01:23 -05:00
JT
8fcf51908a
Fix expansion of row condition implied it (#4795) 2022-03-09 08:05:03 -05:00
JT
925e9f4dcb
Allow quotes in a register call (#4793) 2022-03-09 07:06:44 -05:00
JT
2ac990655e
Add support for var decl spans (#4787) 2022-03-09 04:42:19 -05:00
Darren Schroeder
35ff1076f3
add ansi escape (#4772)
* add ansi escape

* also add the ability to escape parens

* add a few more escapes that could be problematic for the nushell lang
2022-03-07 16:39:16 -06:00
JT
1837bf775c
Default values (#4770) 2022-03-07 15:08:56 -05:00
JT
a2723c2ba4
Fix rest parsing (#4765)
* More nuon tests, fix table print

* Fix rest type parsing
2022-03-07 11:44:27 -05:00
JT
a4a8f5df54
Add more multiline pipeline forms (#4740) 2022-03-05 08:20:13 -05:00
JT
e64ca97fe2
move scope variable into nu variable (#4725) 2022-03-04 11:36:11 -05:00
Genna Wingert
97b3e4a233
Fix aliases to known externals (#4707) 2022-03-03 14:05:55 -05: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
Yutaro Ohno
210d25f2a0
Add into duration (#4683)
* Add `into duration` command

* Avoid using unwrap()

* Use existing logic to parse duration strings
2022-03-03 08:16:04 -05: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