Commit Graph

774 Commits

Author SHA1 Message Date
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
JT
e763a8dcef
Auto-hide aliases to prevent recursion (#4487) 2022-02-15 17:36:24 -05:00
JT
56b3fc61a3
Remove statements, replaced by pipelines (#4482) 2022-02-15 14:31:14 -05:00
JT
a743db8e8f
Improve alias expansion, again (#4474) 2022-02-14 21:09:21 -05:00
JT
fbaafaa459
Make param parsing more resilient, correct missing param error (#4470) 2022-02-14 12:33:47 -05:00
JT
cc171b6ad4
Improve completions with no starting characters (#4433)
* Improve completions with no starting characters

* Fix subexpressions, crashes, and differentiate externals
2022-02-12 10:04:10 -05:00
Jakub Žádník
328f7e92a0
Hide alias (#4432)
* Add alias interning

Now, AliasId is used to reference aliases stored in EngineState, similar
to decls, blocks, etc.

* Fix wrong message

* Fix using decl instead of alias

* Extend also alias id visibility

* Merge also aliases from delta

* Add alias hiding code

Does not work yet but passes tests at least.

* Fix wrong alias lookup and visibility appending

* Add hide alias tests

* Fmt & Clippy

* Fix random clippy warnings in "which" command
2022-02-12 11:50:37 +02:00
JT
a16e485cce
Add support for defining known externals with their own custom completions (#4425)
* WIP for known externals

* Now completions can work from scripts

* Add support for definiing externs

* finish cleaning up old proof-of-concept
2022-02-11 13:38:10 -05:00
JT
886ed5ab2d
Fix captures (#4421)
* Fix rowcondition and import captures

* Only check extra blocks if not yet seen
2022-02-11 07:37:10 -05:00
JT
e6db37bc82
Fix multi-command variable captures (#4413) 2022-02-10 18:15:15 -05:00
JT
2e3b2a48ee
Fix string interpolation paren cases (#4410) 2022-02-10 11:09:08 -05:00
JT
d70d91e559 Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
Fernando Herrera
fdce6c49ab engine-q merge 2022-02-07 19:11:34 +00:00
JT
a008f1aa80
Command tests (#922)
* WIP command tests

* Finish marking todo tests

* update

* update

* Windows cd test ignoring
2022-02-03 21:01:45 -05:00
JT
cc1b784e3d
Add initial nu-test-support port (#913)
* Add initial nu-test-support port

* finish changing binary name

* Oops, these aren't Windows-safe tests
2022-02-02 15:59:01 -05:00
Jakub Žádník
2fbd182993
Allow viewing the source code of blocks (#894)
* Add spans to blocks and view command

* Better description; Cleanup

* Rename "view" command to "view-source"
2022-01-31 00:05:25 +02:00
JT
44821d9941
Add support for def-env and export def-env (#887) 2022-01-29 15:45:46 -05:00
JT
04395ee05c
Allow equals to sep long flag and arg (#858) 2022-01-27 12:20:12 +11:00
JT
6f4b7efd3e
Also set $in-variable with input (#856)
* Also set in-variable with input

* Fix test

* Add more tests
2022-01-27 10:46:13 +11:00
JT
83ec374995
Add -c flag and others to cmdline args (#853)
* Add -c flag and others to cmdline args

* finish a little bit of cleanup

* Oops, forgot file
2022-01-26 12:26:43 -05:00
JT
8ee619954d
Start support for commandline args to nu itself (#851)
* cmdline args wip

* WIP

* redirect working

* Add help and examples

* Only show flags in signature of more than help
2022-01-27 01:42:39 +11:00
JT
af52def93c
Fix doc comments for custom commands (#815) 2022-01-22 13:24:47 -05:00
Darren Schroeder
0ef0277882
allow use to parse quoted paths (#800) 2022-01-21 13:20:13 -06:00
JT
939745ad67
Support recursive functions in capture (#797) 2022-01-21 11:39:55 -05:00
JT
45b3592739
add some more division for units (#783) 2022-01-21 05:23:26 +11:00
Michael Angerman
d4b6b4b09a
update all cargo crates to edition 2021 (#781) 2022-01-21 00:13:45 +11:00
JT
d2d22815fb
Improve env shorthand parse (#777) 2022-01-20 01:58:12 +11:00
JT
49e8af8ea5
Bump to 0.43 (#4264) 2022-01-18 12:06:12 -05:00
JT
f562a4526c
Fix clippy lints (#4262)
* Fix clippy lints

* Fix clippy lints

* Fix clippy lints
2022-01-18 23:33:28 +11:00
Onur Şahin
5fae96a6b1
Fix not equal returning error when same things are compared in some cases (#709)
* Fix not equal returning error when same things are compared in some cases

* Equality operators supports all type combinations
2022-01-17 01:34:20 +11:00
Jakub Žádník
3b4baa31b6
Fix ls relative path & command argument path expansion (#757)
* Switch to short-names when the path is a relative_path (a dir) and exit with an error if the path does not exist

* Remove debugging print line

* Show relative filenames... It does not work yet for ls ../

* Try something else to fix relative paths... it works, but the ../ code part is not very pretty

* Add canonicalize check and remove code clones

* Fix the canonicalize_with issue pointed out by kubouch. Not sure the prefix_str is what kubouch suggested

* Fix the canonicalize_with issue pointed out by kubouch. Not sure the prefix_str is what kubouch suggested

* Add single-dot expansion to nu-path

* Move value path expansion from parser to eval

Fixes #745

* Remove single dot expansion from parser

It is not necessary since it will get expanded anyway in the eval.

* Fix ls to display globs with relative paths

* Use pathdiff crate to get relative paths for ls

Co-authored-by: Stefan Stanciulescu <contact@stefanstanciulescu.com>
2022-01-17 00:55:56 +11:00
JT
b78924c777
Add support for load-env (#752) 2022-01-15 18:50:11 -05:00
JT
f9c0d223c1
Improve keyword parsing, including for (#747)
* Improve keyword parsing, including for

* touchup
2022-01-16 02:26:52 +11:00
Jakub Žádník
40484966c3
Make env var eval order during "use" deterministic (#742)
* Make env var eval order during "use" deterministic

Fixes #726.

* Merge delta after getting config

To make sure env vars are all in the engine state and not in the stack.
2022-01-15 08:06:32 +11:00
JT
82d90f4930
Add support for var/string interp for external names (#729) 2022-01-13 19:17:45 +11:00
Darren Schroeder
d0f9943709
expose a few more types to custom commands (def) (#725) 2022-01-12 09:59:07 -06:00
JT
186da4d725
Fixing captures (#723)
* WIP fixing captures

* small fix

* WIP

* Rewrite to proof-of-concept better parse_def

* Add missing file

* Finish capture refactor

* Fix tests

* Add more tests
2022-01-12 15:06:56 +11:00
JT
d3bfc61524
Don't panic on alias errors (#713) 2022-01-10 13:52:01 +11:00
Jakub Žádník
733b2836f1
Cleanup parsing of use and hide commands (#705) 2022-01-10 12:39:25 +11:00
Jakub Žádník
3b467bedd9
Add reduce command (#700)
* Add reduce command

* Fix example and missing test commands

* Add forgotten file
2022-01-08 02:40:40 +02:00
JT
f016a5cb72
Fix short flags with extra (#696) 2022-01-07 08:06:54 +11:00
JT
e44789556b
Fix path external (#684)
* Fix external invocation/expansion

* clippy
2022-01-06 21:20:31 +11:00
JT
d39e8c15fe
Expand external command names (#682) 2022-01-06 10:32:56 +11:00
JT
cc1ae969fe
Allow int/float to coerce in type checker (#679) 2022-01-06 07:58:58 +11:00
JT
41dbc641cc
Some cleanups for cd/PWD (#667)
* Some cleanups for cd/PWD

* Some cleanups for cd/PWD
2022-01-05 11:26:01 +11:00
Darren Schroeder
4584d69715
tweak source parsing to allow quotes around string (#666) 2022-01-05 10:44:48 +11:00
JT
8f6843c600
Move $nu.env to $env (#665)
* Move env from nu builtin to its own

* update samples/tests
2022-01-05 08:34:42 +11:00
JT
b6fcd46075
Some error improvements (#659) 2022-01-04 10:14:33 +11:00
JT
cb8b7e08a5
Lex comment spans correctly (#657) 2022-01-04 08:37:45 +11:00
JT
fe5f65a247
Highlight block and record (#653) 2022-01-03 16:21:26 +11:00
JT
9535e2c309
Fix list and table print (#652)
* Fix list printing

* Fix list and table highlighting
2022-01-03 14:18:23 +11:00
JT
c9dcd212ba
Allow pipelines across multiple lines if end in pipe (#643)
* Allow pipelines across multiple lines if end in pipe

* Add validation support
2022-01-02 16:27:58 +11:00
JT
ac487dfcbc
Add parser tracing, fix 629 (#638) 2022-01-02 08:42:50 +11:00
JT
80649f2341
Fix flattening of in-variable (#624) 2021-12-30 14:26:40 +11:00
JT
62011b6bcc
Bump to 0.42 (#4234) 2021-12-28 20:56:59 +11:00
JT
384ea111eb
Allow for and other commands missing positionals near keywords (#606)
* Allow for and other commands missing positionals near keywords

* A bit more resilience
2021-12-28 07:04:48 +11:00
Fernando Herrera
53330c5676
def argument check (#604)
* def argument check

* corrected test

* clippy error
2021-12-28 06:13:52 +11:00
JT
3706bef0a1
Require let to be a statement (#594) 2021-12-27 14:04:22 +11:00
JT
ca6baf7a46
Add single tick string interpolation (#581)
* Add single tick string interpolation

* give string interpolation its own highlighting
2021-12-26 07:50:02 +11:00
Jakub Žádník
52dba91e1a
Wrap captured env var names into quotes as well (#546) 2021-12-21 23:31:30 +02:00
Fernando Herrera
e949658381
nothing variable (#527)
* nothing variable

* corrected comments

* added color to nothing like bool

* compare nothing with values

* comparison tests
2021-12-20 12:05:33 +11:00
JT
2883d6cd1e
Remove Span::unknown (#525) 2021-12-19 18:46:13 +11:00
JT
b54e9b6bfd
Fix completion crash (#521) 2021-12-19 07:10:40 +11:00
Fernando Herrera
8933dde324
Plugin option for shell (#517)
* calling plugin without shell

* spelling error

* option on register to select a shell
2021-12-18 12:13:56 -06:00
Fernando Herrera
46b86f3541
Migration of series commands (#515)
* corrected missing shellerror type

* batch dataframe commands

* removed option to find declaration with input

* ordered dataframe folders

* dataframe command name
* series commands

* date commands

* series commands

* series commands

* clippy correction

* rename commands
2021-12-18 17:45:09 +00:00
Darren Schroeder
9a864b5017
allow flatshape (command line syntax) theming (#502)
* allow flatshape (command line syntax) theming

* renamed crate, organized
2021-12-16 06:17:29 -06:00
JT
1d74d9c5ae
Fix comment issue and shadowing issue (#501) 2021-12-16 09:56:12 +11:00
JT
e9525627e6
Fix a couple crlf issues (#496) 2021-12-15 07:17:02 +11:00
JT
04a9c8f3fd
Fix bug in chained boolean typecheck (#490) 2021-12-14 16:19:16 +11:00
Jakub Žádník
930cb26e99
Fix hiding of import patterns with globs (#487)
* Fix glob hiding

* Remove docs comment
2021-12-13 20:35:35 +02:00
JT
bee7ef21eb
Add in variable and sub-command completions (#480)
* WIP

* wip

* Add in variable and subcommand completions

* clippy
2021-12-13 10:18:31 +11:00
Fernando Herrera
34a8a897c5
Plugin json (#475)
* json encoder

* thread to pass messages

* description for example

* check for help flag
2021-12-12 14:00:07 +00:00
Fernando Herrera
4d7dd23779
Plugin json (#474)
* json encoder

* thread to pass messages

* description for example
2021-12-12 11:50:35 +00:00
JT
610e3911f6
Bump to 0.41 (#4187) 2021-12-08 06:21:00 +13:00
Jakub Žádník
ee45755ea9
Add canonicalization to source & use paths (#421)
Also added file path print to FileNotFound error
2021-12-03 21:49:11 +02:00
Fernando Herrera
f3c8d35eb7
Plugin repeated (#417)
* not repeated decl in file and help

* implemented heashmap for repeated

* sorted scope commands
2021-12-03 14:29:55 +00:00
JT
ac2afab40b
Fix parse error metadata (#399) 2021-12-02 19:36:30 +13:00
Fernando Herrera
56307553ae
Plugin with evaluated call (#393)
* plugin trait

* impl of trait

* record and absolute path

* plugin example crate

* clippy error

* correcting cargo

* evaluated call for plugin
2021-12-02 05:42:56 +00:00
Jakub Žádník
124561ff12
Rename add_decls() to use_decls() (#395)
To reflect better what the method actually does.
2021-12-02 00:25:51 +02:00
Jakub Žádník
c17e1473db
Hiding of environment variables (#362)
* Remember environment variables from previous scope

* Re-introduce env var hiding

Right now, hiding decls is broken

* Re-introduce hidden field of import patterns

All tests pass now.

* Remove/Address tests TODOs

* Fix test typo; Report hiding error

* Add a few more tests

* Fix wrong expected test result
2021-11-30 19:14:05 +13:00
JT
f7f8b0dbff
A few help cleanups (#372) 2021-11-28 07:16:20 +13:00
JT
f052b3313d
Move row condition to block (#368) 2021-11-26 16:49:03 +13:00
Edward Betts
3e93ae8af4
Correct spelling (#4152) 2021-11-25 11:11:20 -06:00
JT
143855b662
Add better comment skipping (#359) 2021-11-22 07:13:09 +13:00
ahkrr
e06df124ca
upgrading dependencies (#4135)
* upgrade dependencies
num-bigint 0.3.1 -> 0.4.3
bigdecimal-rs 0.2.1 -> bigdecimal 0.3.0
s3hander 0.7 -> 0.7.5
bat 0.18 -> 0.18, default-features = false

* upgrade arboard 1.1.0 -> 2.0.1

* in polars use comfy-table instead of prettytable-rs
the last release of prettytable-rs was `0.8.0 Sep 27, 2018`
and it uses `term 0.5` as a dependency

* upgrade dependencies

* upgrade trash -> 2.0.1

Co-authored-by: ahkrr <alexhk@protonmail.com>
2021-11-20 07:11:11 -06:00
JT
ff43ca4d24
Better record types (#350) 2021-11-19 17:30:27 +13:00
Fernando Herrera
88988dc9f4
Plugins signature load (#349)
* saving signatures to file

* loading plugin signature from file

* is_plugin column for help command
2021-11-19 15:51:42 +13:00
JT
aa7226d5f6
Expand globs and filepaths (#348) 2021-11-19 08:32:27 +13:00
Jakub Žádník
f8f437b060
Separate Overlay into its own thing (#344)
It's no longer attached to a Block. Makes access to overlays more
streamlined by removing this one indirection. Also makes it easier to
create standalone overlays without a block which might come in handy.
2021-11-17 17:23:55 +13:00
JT
2590fcbe5c
Bump to 0.40 (#4129) 2021-11-16 21:53:03 +13:00
Jakub Žádník
5459d30a24
Add environment variable support for modules (#331)
* Add 'expor env' dummy command

* (WIP) Abstract away module exportables as Overlay

* Switch to Overlays for use/hide

Works for decls only right now.

* Fix passing import patterns of hide to eval

* Simplify use/hide of decls

* Add ImportPattern as Expr; Add use env eval

Still no parsing of "export env" so I can't test it yet.

* Refactor export parsing; Add InternalError

* Add env var export and activation; Misc changes

Now it is possible to `use` env var that was exported from a module.

This commit also adds some new errors and other small changes.

* Add env var hiding

* Fix eval not recognizing hidden decls

Without this change, calling `hide foo`, the evaluator does not know
whether a custom command named "foo" was hidden during parsing,
therefore, it is not possible to reliably throw an error about the "foo"
name not found.

* Add use/hide/export env var tests; Cleanup; Notes

* Ignore hide env related tests for now

* Fix main branch merge mess

* Fixed multi-word export def

* Fix hiding tests on Windows

* Remove env var hiding for now
2021-11-16 12:16:06 +13:00
JT
42367ddf6d
Add support for crlf for line continuations (#341) 2021-11-16 07:33:33 +13:00
JT
be827e5628
Fix multiword imports/exports (#336) 2021-11-15 08:40:26 +13:00
JT
0f107b2830
Add a config variable with engine support (#332)
* Add a config variable with engine support

* Add a config variable with engine support

* Oops, cleanup
2021-11-15 08:25:57 +13:00
JT
14a2918bba
Fix some nightly clippy warnings (#329) 2021-11-13 13:42:13 +13:00
JT
568e566adf
Add record literal syntax (#326) 2021-11-11 12:14:00 +13:00
JT
066afb059e
Add magic in variable, part 2 (#310) 2021-11-08 20:13:55 +13:00
JT
e9a7def183
Add magic $in variable (#309)
* Add magic in variable

* Oops, missing file
2021-11-08 19:21:24 +13:00
JT
b5bade6187
Let list and table exprs get indexed (#307) 2021-11-08 12:18:00 +13:00
JT
6c31377c21
Fix precedence parse (#298) 2021-11-06 20:31:28 +13:00
JT
02b8027749
Improve external output in subexprs (#294) 2021-11-06 18:50:33 +13:00
ahkrr
649b3804c1
fix: panic! during parsing (#4107)
Typing `selector -qa` into nu would cause a `panic!`
This was the case because the inner loop incremented the `idx`
that was only checked in the outer loop and used it to index into
`lite_cmd.parts[idx]`
With the fix we now break loop.

Co-authored-by: ahkrr <alexhk@protonmail.com>
2021-11-05 21:46:46 +13:00
Fernando Herrera
ae1109139d Merge branch 'main' of https://github.com/nushell/engine-q into plugins 2021-11-04 22:04:31 +00:00
JT
1949ba080e Add env shorthand 2021-11-04 15:32:35 +13:00
Fernando Herrera
e193bf43fb multiple functions in plugin 2021-11-02 21:51:11 +00:00
Fernando Herrera
12eed1f98a plugin feature flag 2021-11-02 20:56:00 +00:00
JT
7b2116dc29
Merge pull request #270 from elferherrera/plugins
Plugins for engine q
2021-11-02 19:07:45 +13:00
JT
d856cebebd Add a simple scope variable 2021-11-02 16:08:05 +13:00
Fernando Herrera
ef94c71866 Merge branch 'main' of https://github.com/nushell/engine-q into plugins 2021-11-01 07:24:33 +00:00
Fernando Herrera
43c3cfecf7 plugin call function 2021-11-01 07:20:33 +00:00
JT
3176f60b5b
Merge pull request #243 from kubouch/module-files
Loading modules from files
2021-11-01 11:08:03 +13:00
Jakub Žádník
73ae3daf85 Add invalid UTF-8 error to use and source
Also changed the error message to be more universal.
2021-10-31 17:53:53 +02:00
Jakub Žádník
f182524298 Add TODO notes 2021-10-31 17:46:37 +02:00
Jakub Žádník
b7c0ba104f Fix hiding module; Fmt
This fixes the case when you call `hide spam`. It will now hide all
commands you'd call like `spam foo` etc.
2021-10-31 17:38:00 +02:00
Jakub Žádník
7112664b3f Fix wrong spans of multiple files
The introduction of `use <file.nu>` added the possibility of calling
`working_set.add_file()` more than once per parse pass. Some of the
logic handling the file contents offsets prevented it from working and
hopefully, this commit fixes it.
2021-10-31 17:22:10 +02:00
Fernando Herrera
a390f66dbf call and response serializers 2021-10-31 08:17:01 +00:00
Jakub Žádník
751595e72e Add multi-word name calling support 2021-10-29 23:50:28 +03:00
JT
cf3f3fde92 Add some support for 2021-10-30 07:15:17 +13:00
Jakub Žádník
4fc533340b Add function that searches for multi-word commands
It doesn't do anything right now.
2021-10-28 00:53:28 +03:00
Jakub Žádník
b5329fe4ec Cleanup; Remove redundant UTF-8 check 2021-10-27 00:34:39 +03:00
Jakub Žádník
78256b4923 Fix syntax highlighting for new import patterns 2021-10-27 00:30:39 +03:00
Jakub Žádník
bd6c550470 Change import pattern delimiter to space
Subcommands and module imports will have the same syntax now.
2021-10-27 00:13:39 +03:00
JT
2b06ce27d3
Bump to 0.39 (#4097) 2021-10-27 08:36:41 +13:00
Jakub Žádník
a240aead8c Add loading module from file
Currently, `use spam.nu` creates a module `spam`. Therefore, after the
first `use`, it is possible to call both `use spam.nu` and `use spam`
with the same effect.
2021-10-26 21:03:12 +03:00
Jakub Žádník
75b3b3e090 Add comments 2021-10-26 21:03:12 +03:00
Jakub Žádník
5163dbb7a1 Add tests and cover edge cases of the :: delim. 2021-10-26 21:03:12 +03:00
Jakub Žádník
cbda1b1650 Change import pattern delimiter to :: 2021-10-26 21:03:12 +03:00
Jakub Žádník
e66fd91045 Move module block parsing into its own function 2021-10-26 21:03:12 +03:00
JT
d29208dd9e WIP 2021-10-26 09:04:23 +13:00
JT
b5965ee8ef WIP 2021-10-25 19:31:39 +13:00
JT
b6d269e90a WIP 2021-10-25 17:01:02 +13:00
JT
1296100d31 Clippy fixes 2021-10-24 12:40:27 +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
aea8627c30 Prevent invalid var names 2021-10-12 18:08:55 +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
1f45304cf9 Fix parser when def has missing params 2021-10-12 09:58:38 +13:00
JT
63e3552eef Add the remaining missing operators 2021-10-12 09:35:12 +13:00
Jakub Žádník
77c520e10b Make predeclarations scoped; Add hiding tests
In some rare cases, the global predeclarations would clash, for example:

  > module spam { export def foo [] { "foo" } }; def foo [] { "bar" }

In the example, the `foo [] { "bar" }` would get predeclared first, then
the predeclaration would be overwritten and consumed by `foo [] {"foo"}`
inside the module, then when parsing the actual `foo [] { "bar" }`, it
would not find its predeclaration.
2021-10-10 14:31:13 +03:00
Arthur Targaryen
9e7e8ed48f Handle not-in operator 2021-10-09 19:40:47 +02:00
Arthur Targaryen
7f06d6144f Support in operator for record and value stream 2021-10-09 19:27:54 +02:00
Arthur Targaryen
8783cf0138 Add basic in operator support 2021-10-09 19:27:54 +02:00
JT
e4ce41ba15 Fix the for loop to create vars 2021-10-10 05:10:46 +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
1b977c658c Improve the alias expansion 2021-10-09 08:38:42 +13:00
JT
7eb022b58c Adapt tk's work for a source command 2021-10-06 15:29:05 +13:00
Tanishq Kancharla
d481d5ca96 Merge branch 'main' of https://github.com/nushell/engine-q into source-command 2021-10-05 22:16:07 -04:00
Tanishq Kancharla
996ee363b7 comments 2021-10-05 22:03:18 -04:00
Tanishq Kancharla
011ad2e4e6 Merge branch 'source-command' of https://github.com/moonrise-tk/engine-q into source-command 2021-10-05 21:59:26 -04:00
Tanishq Kancharla
d6d0bad7aa reverted 2021-10-05 21:59:16 -04:00
JT
e1ebd461d2
Bump to 0.28 (#4064) 2021-10-06 06:35:25 +13:00
JT
535ece4e76 Add unit parsing and eval support 2021-10-05 15:27:39 +13:00
JT
26166192e5
Merge pull request #89 from kubouch/hide-import-patterns
Add import patterns to 'hide'
2021-10-05 10:44:13 +13:00
Jakub Žádník
6f5f1fa43a Clippy 2021-10-04 22:37:43 +03:00
JT
a88058006a Add path completions 2021-10-05 08:21:31 +13:00
Jakub Žádník
4dacfaa44a Add import pattern support to 'hide' 2021-10-04 20:08:24 +03:00
Tanishq Kancharla
dfd321a679
Merge branch 'main' into source-command 2021-10-03 14:25:00 -04:00
Tanishq Kancharla
909b7d2160 no-op 2021-10-03 14:23:23 -04:00
Jakub Žádník
81cd03626d
Merge branch 'main' into module-export 2021-10-02 18:53:35 +03:00
JT
5843acec02 Add wrap and get and cell_path parsing 2021-10-02 15:59:11 +13:00
Tanishq Kancharla
8ef16c6da6 add source command 2021-10-01 22:25:35 -04:00
Tanishq Kancharla
e1a0ad2987 fix more merge conflicts 2021-10-01 22:24:43 -04:00
Tanishq Kancharla
16c60f44d5 merge w/ upstream 2021-10-01 22:09:16 -04:00
Tanishq Kancharla
adb92b970e nothing 2021-10-01 22:07:17 -04:00
Jakub Žádník
6595c06598 Relax panic into error
Convert the panic when declaration cannot find predeclaration into an
error. This error is already covered and reported in the predeclaration
phase.
2021-10-02 03:42:35 +03:00
Jakub Žádník
25b05dec9e Fix panic on double def; Tests; Double def error
* Fixes a panic with defining two commands with the same name caused by
  declaration not found after predeclaration.
* Adds a new error if a custom command is defined more than once in one
  block.
* Add some tests
2021-10-01 23:25:24 +03:00
Jakub Žádník
2af8116f50 Fix hiding logic; Fix hiding with predecls
* Hiding logic is simplified and fixed so you can hide and unhide the
  same def repeatedly.
* Separates predeclared ids into its own data structure to protect them
  from hiding. Otherwise, you could hide the predeclared variable and
  the actual def would panic.
2021-10-01 23:24:57 +03:00
Jakub Žádník
7488254cca Implement a rough version of 'hide'
'hide' command is used to undefine custom commands
2021-10-01 23:24:54 +03:00
Jakub Žádník
3cbf99053f Throw an error if using export outside of module 2021-10-01 23:21:30 +03:00
Jakub Žádník
93521da9d8 Add 'export def' command 2021-10-01 23:21:28 +03:00
Jakub Žádník
561feff365 Introduce 'export' keyword 2021-10-01 23:19:39 +03:00
Jakub Žádník
1b89ccf25b Add comment 2021-10-01 23:19:39 +03:00
Tanishq Kancharla
e00755a2e9 fix compile errors 2021-09-30 23:04:56 -04:00
Squirrel
4e0d7bc77c
Less deps (#4038)
* compiles on nightly now. (breaking change)

* less deps

* Switch over to new resolver

(it's been stable for a while.)

* let's leave num-format for another PR
2021-09-28 07:17:00 +13:00
Tanishq Kancharla
719920fa37 tried to move source command into parser (still doesn't compile) 2021-09-27 08:10:18 -04:00
JT
84d0e0a059 More forgiving def parse 2021-09-27 14:03:50 +13:00
JT
0a48bc973d
Merge pull request #72 from nushell/import_patterns
Add import lists
2021-09-27 13:32:36 +13:00
JT
0108a935ed add import lists 2021-09-27 13:23:22 +13:00
Jakub Žádník
9ee4dc49ee Fix wrong error span 2021-09-27 00:02:20 +03:00
JT
abb0d7bd22 Add support for module imports 2021-09-27 07:39:19 +13:00
Jakub Žádník
f57f7b2def Allow adding definitions from module into scope 2021-09-26 13:53:52 +03:00
Jakub Žádník
9e176674a5 Start parsing 'use'; Add Use command 2021-09-26 13:25:52 +03:00
Jakub Žádník
12cf1a8f83 Allow adding module blocks to engine state 2021-09-26 12:12:32 +03:00
Jakub Žádník
e9f1575924 Add a module command 2021-09-26 01:59:18 +03:00
Jakub Žádník
a176f12c9e Start simple module parsing 2021-09-25 17:14:20 +03:00
Kat Marchán
5d442a287f
deps: bump to miette 3.0 mainline 2021-09-22 16:50:57 -07:00
JT
0ccbebee7a multiline validation 2021-09-22 17:29:53 +12:00
Kat Marchán
2553da3dc4
bump miette to fix multi-file rendering bug 2021-09-21 17:57:16 -07:00
Kat Marchán
32f39c2fb8
use miette's new panic hook 2021-09-21 12:47:52 -07:00
Kat Marchán
c87414e462
Fix issue with unexpected EOF rendering in miette 2021-09-21 09:30:43 -07:00
JT
3c18cac134 use the fancy 2021-09-21 16:10:29 +12:00
JT
4841d62d76 Add some improvements to errors 2021-09-21 16:03:06 +12:00
Kat Marchán
a1d6cefdf8
replace codespan-reporting with miette 3.0 2021-09-20 17:14:20 -07:00
Jakub Žádník
349af05da8
Do not throw error for files not found in lib_dirs (#4029) 2021-09-20 13:44:47 -05:00
JT
8581bec891
bump 0.37.1 (#4019) 2021-09-16 13:32:22 +12:00
JT
1d80a68f4c
bump to 0.37 (#4006) 2021-09-15 06:44:24 +12:00
JT
b4f918b889 Very early proof-of-concept git branch completion 2021-09-14 16:59:46 +12:00
Fernando Herrera
7aa1d8ac2a error check on def and alias 2021-09-13 20:59:11 +01:00
JT
d7a3c7522b Fix test 2021-09-13 20:19:05 +12:00
JT
4dfde7393b Merge branch 'main' into block_param_types 2021-09-13 19:59:18 +12:00
JT
32c1f0c8d4 better it detection and block params in shapes 2021-09-13 19:54:13 +12:00
JT
eb67eab122 WIP 2021-09-13 19:31:11 +12:00
JT
d88e46d2d1
Merge pull request #45 from kubouch/left-unbounded-ranges
Allow parsing left-unbounded range (..10)
2021-09-13 05:01:07 +12:00
JT
caa6236f1f
Merge pull request #44 from kubouch/float-ranges
Floating point ranges
2021-09-13 04:59:51 +12:00
JT
f459f77335
Merge pull request #40 from elferherrera/parse-error
Parse errors for def, let and alias
2021-09-13 04:58:25 +12:00
Fernando Herrera
66c58217af change message 2021-09-12 16:36:16 +01:00
Jakub Žádník
e6a2e27e33 Fix failing compilation after rebase 2021-09-12 15:57:49 +03:00
Jakub Žádník
8577d3ff41 Check for left-unbounded range before external cmd 2021-09-12 15:56:58 +03:00
Jakub Žádník
78054a5352 Allow parsing left-unbounded range (..10)
It is implemented as a preliminary check when parsing a call and relies
on a fact that a token that successfully parses as a range is unlikely
to be a valid path or command name.
2021-09-12 15:56:58 +03:00
Jakub Žádník
ce0b5bf4ab Add test for float ranges 2021-09-12 15:36:54 +03: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
JT
648fe052db Merge branch 'main' into wip 2021-09-12 09:26:47 +12:00
JT
55aa70c88a WIP 2021-09-12 09:26:35 +12:00
Fernando Herrera
9c98783917 clippy correcgtions 2021-09-11 13:16:40 +01:00
Fernando Herrera
4b8ba29cdb check for = before internal parsing 2021-09-11 13:07:19 +01: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
Fernando Herrera
47ee50072e Merge branch 'main' of https://github.com/nushell/engine-q into parse-error 2021-09-11 08:26:29 +01:00
Fernando Herrera
198c884158 change name in error 2021-09-11 08:22:41 +01:00
JT
bfd05772ef Improve completions inside of a pipeline 2021-09-10 20:07:18 +12:00
Fernando Herrera
9a16a8fd06 corrected error check 2021-09-10 08:44:31 +01:00
Fernando Herrera
2ea19aeac0 Merge branch 'main' of https://github.com/nushell/engine-q into parse-error 2021-09-10 08:28:58 +01:00
Fernando Herrera
0794ebf5fa error parsing for def, alias and let 2021-09-10 08:28:43 +01:00
Tom Panton
55eafadf02
Improve error message when bash-style alias syntax is mistakenly used (#3995) 2021-09-10 10:44:55 +12: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
2d7192e390 Add parser README, some parser fixups 2021-09-09 06:54:27 +12:00
JT
6dd9f05ea1 Add an experimental record iteration 2021-09-08 10:00:20 +12:00
JT
b0ab78a767 Switch tables to list/streams of records 2021-09-07 19:07:11 +12:00
JT
e00da070fd Fail more gently for bad list/table parses 2021-09-07 15:56:30 +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
Fernando Herrera
f7a19d37c6 one parser function 2021-09-06 21:41:30 +01:00
JT
979faf853a Block params 2021-09-06 14:20:02 +12:00
JT
aaee3a8b61 WIP 2021-09-06 11:16:27 +12:00
JT
57677a50b5 Fix #15 2021-09-06 06:44:18 +12:00
JT
6ebc97dec2
Update parser.rs 2021-09-06 06:09:36 +12:00
Jakub Žádník
56c8987e0f Add '.' and '-' to restricted characters
This means that commands cannot start with these characters.
However, we get the following benefits:
* Negative numbers               > -10
* Ranges with negative numbers   > -10..-1
* Left-unbounded ranges          > ..10
2021-09-05 20:33:53 +03:00
Jakub Žádník
7ae4ca88b6 "Fix" failing CI 2021-09-05 11:03:04 +03:00
Jakub Žádník
f0d469f1d4 Fix clippy warnings 2021-09-05 01:40:15 +03:00
Jakub Žádník
6b4fee88c9 Fmt 2021-09-05 01:35:08 +03:00
Jakub Žádník
672fa852b3 Add some tests to range parsing 2021-09-05 01:25:31 +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
Fernando Herrera
ab307c8d38 Merge branch 'main' of https://github.com/jonathandturner/engine-q into similar-name 2021-09-04 09:10:38 +01:00
Fernando Herrera
a3d4794341 moved test to protocol 2021-09-04 09:10:31 +01:00
JT
25c7d8ead6
Merge pull request #13 from jntrnr/ci
Add CI
2021-09-04 20:09:05 +12:00
JT
d9cff4238d clippy 2021-09-04 19:59:38 +12:00
Fernando Herrera
ca8d311c78 Merge branch 'main' of https://github.com/jonathandturner/engine-q into similar-name 2021-09-04 08:45:55 +01:00
Fernando Herrera
acc035dbef signature check for similar name 2021-09-04 08:45:49 +01:00
JT
5e33b8536b Add discrete list/table 2021-09-04 18:52:28 +12:00
JT
74bb2af3e1 Fix up block parse recovery 2021-09-04 08:58:44 +12:00
JT
b20c4047d4 Some cleanup, better subexpressions 2021-09-03 19:35:29 +12:00
JT
bc3f820227
Merge pull request #10 from jntrnr/value_streams_in_value
Value streams in value
2021-09-03 15:49:27 +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
Fernando Herrera
4ed79614ac removed unused empty function 2021-09-01 21:34:16 +01:00
Fernando Herrera
73f6a57b12 upper comments get attached to command 2021-09-01 21:05:37 +01:00
Fernando Herrera
5da2ab1b7d comments with a newline dont get together 2021-08-31 20:33:41 +01:00
JT
d0be193307
Merge pull request #7 from elferherrera/tests
Tests for lex and lite parser
2021-08-31 12:07:46 +12:00
Fernando Herrera
b3fb106cce tests for lex and lite parser 2021-08-30 19:36:07 +01: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
Markus Westerlind
1c1c58e802
Remove duplicate dependencies (#3961)
* chore: Replace surf with reqwest

Removes a lot of older, duplication versions of some dependencies
(roughtly 90 dependencies removed in total)

* chore: Remove syn 0.11

* chore: Remove unnecessary features from ptree

Removes some more duplicate dependencies

* cargo update

* Ensure we run the fetch and post plugins on the tokio runtime

* Fix clippy warning

* fix: Github requires a user agent on requests

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2021-08-28 15:34:11 +12:00
JT
7fe05b8296
bump to 0.36.1 (#3972) 2021-08-27 20:48:58 +12:00
JT
bb9e6731ea More parsing fixes with tests 2021-08-27 11:44:08 +12:00
JT
5dd5a89775 Fix condition parsing for if 2021-08-27 09:48:27 +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
Andrés N. Robalino
9d8845d7ad
Allow custom lib dir path for sourcing nu script libraries. (#3940)
Given we can write nu scripts. As the codebase grows, splitting into many smaller nu scripts is necessary.

In general, when we work with paths and files we seem to face quite a few difficulties. Here we just tackle one of them and it involves sourcing
files that also source other nu files and so forth. The current working directory becomes important here and being on a different directory
when sourcing scripts will not work. Mostly because we expand the path on the current working directory and parse the files when a source command
call is done.

For the moment, we introduce a `lib_dirs` configuration value and, unfortunately, introduce a new dependency in `nu-parser` (`nu-data`) to get
a handle of the configuration file to retrieve it. This should give clues and ideas as the new parser engine continues (introduce a way to also know paths)

With this PR we can do the following:

Let's assume we want to write a nu library called `my_library`. We will have the code in a directory called `project`: The file structure will looks like this:

```
project/my_library.nu
project/my_library/hello.nu
project/my_library/name.nu
```

This "pattern" works well, that is, when creating a library have a directory named `my_library` and next to it a `my_library.nu` file. Filling them like this:

```

source my_library/hello.nu
source my_library/name.nu
```

```

def hello [] {
  "hello world"
}
```

```

def name [] {
  "Nu"
end
```

Assuming this `project` directory is stored at `/path/to/lib/project`, we can do:

```
config set lib_dirs ['path/to/lib/project']
```

Given we have this `lib_dirs` configuration value, we can be anywhere while using Nu and do the following:

```
source my_library.nu

echo (hello) (name)

```
2021-08-26 02:04:04 -05:00
JT
35c3622405 Add a few operators. Needs parser work 2021-08-26 07:29:36 +12:00
JT
991a4801b1
Bump to 0.36 (#3963) 2021-08-25 06:01:17 +12:00
Jakub Žádník
e11b400a75
Allow source to accept paths with emojis (#3939)
* Allow sourcing paths with emojis

* Add source command tests for emoji paths

* Fmt

* Disable source tests on Windows with illegal paths

* Test sourcing also ASCII and single-quoted paths
2021-08-19 19:06:18 +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
dda6554990 Fix up subcommand alias colours 2021-08-17 11:04:45 +12:00
JT
2f43cc353b Fix some expects, add subcommand alias 2021-08-17 11:00:00 +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
soumil-07
cd814851da
Use bigdecimal-rs patch (#3905)
* Use bigdecimal-rs patch

* fix nu-serde's bigdecimal dependency
2021-08-07 09:27:19 +12:00
JT
bc682066d8
Bump to 0.35 (#3884) 2021-08-03 20:01:09 +12:00
Lily Mara
762e528ec5
Support equals sign in shorthand environment variable values (#3869)
Some environment variables, such as `RUST_LOG` include equals signs. Nushell
should support this in the shorthand environment variable syntax so that
developers using these variables can control them easily. We accomplish this by
swapping `std::str::split` for `std::str::splitn`, which ensures that we only
consider the first equals sign in the string instead of all of them, which we
did previously.

Closes #3867
2021-07-31 09:10:28 +12:00
Darren Schroeder
1e15f26e98
fix interpolated strings when using unicode (#3866)
* fix interpolated strings when using unicode

* added test case
2021-07-29 19:07:34 -05:00
JT
226739d13f
Bump to 0.34.1 (#3835) 2021-07-25 22:58:33 +12:00
JT
71f4ea9d76
Bump to 0.34.0 (#3766) 2021-07-14 05:57:41 +12:00
Bruce Mitchener
f603b7ef8b
Remove empty trace feature. (#3732)
In `nu-parser`, this was a relic of when nom was used by the parser
and it would enable using `nom-tracable`.
2021-07-06 07:21:28 +12:00
JT
0c82c1920e
Support multiple shorthand env vars (#3692) 2021-06-26 14:15:57 +12:00
JT
b1970f79ee
Add support for arbitrarily nested subcommands (#3688) 2021-06-26 09:09:06 +12:00
Võ Anh Duy
6cdd8a2b07
Fix string interpolation is not working with external command (#3686) 2021-06-26 08:14:54 +12:00
JT
93b5f3f421
Make lexing configurable wrt newlines (#3682) 2021-06-25 17:50:24 +12:00
JT
cac2875c96
Improve def parse errors (#3681) 2021-06-25 17:18:38 +12:00
JT
edbc828fc3
Bump to 0.33.1 (#3671) 2021-06-23 19:57:41 +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
JT
55cab9eb4f
Bump to 0.33 (#3667) 2021-06-22 17:22:33 +12:00
JT
318d13ed58
Add built-in var to refer to pipeline values (#3661) 2021-06-21 12:31:01 +12:00
Niklas Jonsson
a8f6a13239
Move path handling to nu-path (#3653)
* fixes #3616
2021-06-20 11:07:26 +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