1
0
mirror of https://github.com/nushell/nushell.git synced 2025-01-14 10:18:14 +01:00
Commit Graph

681 Commits

Author SHA1 Message Date
Herlon Aguiar
13869e7d52
nu-cli: refactor completions () 2022-04-06 19:58:55 +12:00
JT
abe028f930
Add raw strings, use raw strings for env () 2022-04-05 08:42:26 +12:00
JT
6649da3f5d
Add support for single value row conditions () 2022-04-03 10:41:36 +12:00
Darren Schroeder
2cb815b7b4
Add starts with operator ()
* 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 () 2022-03-31 11:11:03 +03:00
Reilly Wood
31a4fc41eb
Fix env var shorthand when value contains = () 2022-03-30 09:56:55 +13:00
JT
82e3bb0f38
Bump nushell to 0.60.1 () 2022-03-27 16:18:47 +13:00
JT
cf88c8eef3
Improve escaping in string interpolation () 2022-03-27 12:52:09 +13:00
JT
66087b01e6
Improve the 'use' and 'source' errors ()
* Improve the 'use' and 'source' errors

* Add register
2022-03-26 10:43:46 +13:00
JT
d122827a30
Fix operator precedence parser () 2022-03-25 16:23:08 +13:00
Tomoki Aonuma
90013295aa
Fix parse_string_strict() to detect unbalanced quotes properly () 2022-03-25 05:57:03 +13:00
JT
eceae26b0a
Update Cargo.toml 2022-03-23 09:39:03 +13:00
JT
ec5fd62f9f
Add licenses ()
* Add licenses

* Add licenses
2022-03-23 09:25:38 +13:00
JT
1c964cdfe7
Bump to 0.60 ()
* WIP

* semi-revert metadata change
2022-03-23 07:32:03 +13:00
JT
66e736dab4
Externals shouldn't expand aliases () 2022-03-22 11:57:48 +13:00
JT
bd5778fa24
remove the boolean vars () 2022-03-20 08:12:10 +13:00
JT
f3bb1d11d3
Add export alias and export extern ()
* export alias

* export extern
2022-03-20 07:58:01 +13:00
JT
983d115bc0
Add an alias denylist for expansions () 2022-03-19 08:03:57 +13:00
JT
7773c4cd4d
Fix single quote external interpolation () 2022-03-18 19:59:28 +13:00
JT
d0cbb2d12c
Allow expanding aliases before keywords, improve hiding ()
* 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 () 2022-03-16 05:09:30 +13:00
JT
54d9fff4f2
Revert "Alias to keywords (eg source) ()" ()
This reverts commit c023d4111a.
2022-03-13 13:38:16 -07:00
JT
c023d4111a
Alias to keywords (eg source) ()
* Allow aliasing source

* Add test
2022-03-13 11:30:37 -07:00
Jakub Žádník
c73d8d5f95
Add LIB_DIRS and PLUGIN_DIRS ()
* 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 ()
* Move completions to DeclId

* fmt

* fmt
2022-03-10 09:49:02 +02:00
JT
3bdd924349
Fixes the panic when using externs + string interpolation () 2022-03-09 13:01:23 -05:00
JT
8fcf51908a
Fix expansion of row condition implied it () 2022-03-09 08:05:03 -05:00
JT
925e9f4dcb
Allow quotes in a register call () 2022-03-09 07:06:44 -05:00
JT
2ac990655e
Add support for var decl spans () 2022-03-09 04:42:19 -05:00
Darren Schroeder
35ff1076f3
add ansi escape ()
* 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 () 2022-03-07 15:08:56 -05:00
JT
a2723c2ba4
Fix rest parsing ()
* 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 () 2022-03-05 08:20:13 -05:00
JT
e64ca97fe2
move scope variable into nu variable () 2022-03-04 11:36:11 -05:00
Genna Wingert
97b3e4a233
Fix aliases to known externals () 2022-03-03 14:05:55 -05:00
JT
7d0531d270
Add support for escape characters, make nuon a JSON superset ()
* 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 ()
* 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 ()
* 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
JT
4965f4cbf4
Bump to 0.59.1 () 2022-03-01 16:55:51 -05:00
JT
a6a96b29cb
Add binary literals () 2022-02-28 18:31:53 -05:00
JT
0c3ea636fb
Add support for stderr and exit code () 2022-02-25 14:51:31 -05:00
JT
977ef66356
Fix Windows doc comments ()
* WIP windows doc comments

* WIP windows doc comments

* WIP windows doc comments

* actual fix this time
2022-02-25 13:03:39 -05:00
JT
3c62d27c28
Try again with math-like externals ()
* Try again with math-like externals

* clippy 1.59

* clippy 1.59

* clippy 1.59
2022-02-24 14:02:28 -05:00
Justin Ma
2c9d8c4818
fix: , try to fix the source -h not work issue () 2022-02-24 10:32:10 -05:00
JT
308ab91aff
Speed up the parser and nuon parser a bit more () 2022-02-24 07:58:53 -05:00
JT
4b18fdcc6e
Date literals ()
* Date literals

* update deps

* Add date+duration
2022-02-23 21:02:48 -05:00
JT
25712760ba
Add support for math-like externals () 2022-02-22 10:55:28 -05:00
JT
3e8a41fbc9
Speedup unit parse ()
* Compact nuon tables

* Speed up unit parsing a bit
2022-02-22 04:50:49 -05:00
JT
9888f8f298
Add pipeline redirection support ()
* redirection

* Remove commented-out

* fix tests

* more fixes
2022-02-21 17:22:21 -05:00
Jakub Žádník
739e403cd5
Do not set visibility to true automatically ()
Adding it by default grows the size of the visibility structure a lot.
2022-02-21 16:42:31 -05:00
Jakub Žádník
359bb6eebe
Look up predecl only in the working set ()
Previously, the parser tried to look up the predecl also in the
permanent state and if a definition with that name already existed, it
would try to update it, which is illegal.
2022-02-21 16:05:20 -05:00
Darren Schroeder
88fa40d698
rename flatshape_* to shape_* () 2022-02-21 12:27:21 -06:00
JT
6670b77b27
Fix shorthand env duplicates () 2022-02-21 12:58:04 -05:00
JT
a96f8b891e
more strict nuon handling, better nuon errors ()
* more strict nuon handling, better nuon errors

* Improve errors a bit more
2022-02-20 22:31:50 -05:00
JT
9ea5a2ecd3
Improve missing param error span () 2022-02-19 21:30:29 -05:00
Jakub Žádník
f65955ccc5
Fix wrong FlatShape name of List () 2022-02-18 18:31:28 +02:00
Jakub Žádník
bccce0ab46
Use overlay ID for module import lookup ()
* Add id to import pattern

* Finish testing importing in a block
2022-02-17 20:58:24 -05:00
JT
f5f9d56c37
Move to a standard kebab/snake style () 2022-02-17 09:55:17 -05:00
JT
6e733f49bc
Require block params ()
* Require block params

* Improve errors
2022-02-17 06:40:24 -05:00
JT
e763a8dcef
Auto-hide aliases to prevent recursion () 2022-02-15 17:36:24 -05:00
JT
56b3fc61a3
Remove statements, replaced by pipelines () 2022-02-15 14:31:14 -05:00
JT
a743db8e8f
Improve alias expansion, again () 2022-02-14 21:09:21 -05:00
JT
fbaafaa459
Make param parsing more resilient, correct missing param error () 2022-02-14 12:33:47 -05:00
JT
cc171b6ad4
Improve completions with no starting characters ()
* 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 ()
* 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 ()
* 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 ()
* 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 () 2022-02-10 18:15:15 -05:00
JT
2e3b2a48ee
Fix string interpolation paren cases () 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 ()
* 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 ()
* 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 ()
* 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 () 2022-01-29 15:45:46 -05:00
JT
04395ee05c
Allow equals to sep long flag and arg () 2022-01-27 12:20:12 +11:00
JT
6f4b7efd3e
Also set $in-variable with input ()
* 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 ()
* 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 ()
* 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 () 2022-01-22 13:24:47 -05:00
Darren Schroeder
0ef0277882
allow use to parse quoted paths () 2022-01-21 13:20:13 -06:00
JT
939745ad67
Support recursive functions in capture () 2022-01-21 11:39:55 -05:00
JT
45b3592739
add some more division for units () 2022-01-21 05:23:26 +11:00
Michael Angerman
d4b6b4b09a
update all cargo crates to edition 2021 () 2022-01-21 00:13:45 +11:00
JT
d2d22815fb
Improve env shorthand parse () 2022-01-20 01:58:12 +11:00
JT
49e8af8ea5
Bump to 0.43 () 2022-01-18 12:06:12 -05:00
JT
f562a4526c
Fix clippy lints ()
* 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 ()
* 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 ()
* 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 

* 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 () 2022-01-15 18:50:11 -05:00
JT
f9c0d223c1
Improve keyword parsing, including for ()
* 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 ()
* Make env var eval order during "use" deterministic

Fixes .

* 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 () 2022-01-13 19:17:45 +11:00
Darren Schroeder
d0f9943709
expose a few more types to custom commands (def) () 2022-01-12 09:59:07 -06:00
JT
186da4d725
Fixing captures ()
* 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 () 2022-01-10 13:52:01 +11:00
Jakub Žádník
733b2836f1
Cleanup parsing of use and hide commands () 2022-01-10 12:39:25 +11:00
Jakub Žádník
3b467bedd9
Add reduce command ()
* 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 () 2022-01-07 08:06:54 +11:00
JT
e44789556b
Fix path external ()
* Fix external invocation/expansion

* clippy
2022-01-06 21:20:31 +11:00
JT
d39e8c15fe
Expand external command names () 2022-01-06 10:32:56 +11:00
JT
cc1ae969fe
Allow int/float to coerce in type checker () 2022-01-06 07:58:58 +11:00
JT
41dbc641cc
Some cleanups for cd/PWD ()
* 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 () 2022-01-05 10:44:48 +11:00
JT
8f6843c600
Move $nu.env to $env ()
* Move env from nu builtin to its own

* update samples/tests
2022-01-05 08:34:42 +11:00
JT
b6fcd46075
Some error improvements () 2022-01-04 10:14:33 +11:00
JT
cb8b7e08a5
Lex comment spans correctly () 2022-01-04 08:37:45 +11:00
JT
fe5f65a247
Highlight block and record () 2022-01-03 16:21:26 +11:00
JT
9535e2c309
Fix list and table print ()
* 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 ()
* 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 () 2022-01-02 08:42:50 +11:00
JT
80649f2341
Fix flattening of in-variable () 2021-12-30 14:26:40 +11:00
JT
62011b6bcc
Bump to 0.42 () 2021-12-28 20:56:59 +11:00
JT
384ea111eb
Allow for and other commands missing positionals near keywords ()
* 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 ()
* def argument check

* corrected test

* clippy error
2021-12-28 06:13:52 +11:00
JT
3706bef0a1
Require let to be a statement () 2021-12-27 14:04:22 +11:00
JT
ca6baf7a46
Add single tick string interpolation ()
* 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 () 2021-12-21 23:31:30 +02:00
Fernando Herrera
e949658381
nothing variable ()
* 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 () 2021-12-19 18:46:13 +11:00
JT
b54e9b6bfd
Fix completion crash () 2021-12-19 07:10:40 +11:00
Fernando Herrera
8933dde324
Plugin option for shell ()
* 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 ()
* 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 ()
* 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 () 2021-12-16 09:56:12 +11:00
JT
e9525627e6
Fix a couple crlf issues () 2021-12-15 07:17:02 +11:00
JT
04a9c8f3fd
Fix bug in chained boolean typecheck () 2021-12-14 16:19:16 +11:00
Jakub Žádník
930cb26e99
Fix hiding of import patterns with globs ()
* Fix glob hiding

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

* wip

* Add in variable and subcommand completions

* clippy
2021-12-13 10:18:31 +11:00
Fernando Herrera
34a8a897c5
Plugin json ()
* 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 ()
* json encoder

* thread to pass messages

* description for example
2021-12-12 11:50:35 +00:00
JT
610e3911f6
Bump to 0.41 () 2021-12-08 06:21:00 +13:00
Jakub Žádník
ee45755ea9
Add canonicalization to source & use paths ()
Also added file path print to FileNotFound error
2021-12-03 21:49:11 +02:00
Fernando Herrera
f3c8d35eb7
Plugin repeated ()
* 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 () 2021-12-02 19:36:30 +13:00
Fernando Herrera
56307553ae
Plugin with evaluated call ()
* 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() ()
To reflect better what the method actually does.
2021-12-02 00:25:51 +02:00
Jakub Žádník
c17e1473db
Hiding of environment variables ()
* 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 () 2021-11-28 07:16:20 +13:00
JT
f052b3313d
Move row condition to block () 2021-11-26 16:49:03 +13:00
Edward Betts
3e93ae8af4
Correct spelling () 2021-11-25 11:11:20 -06:00
JT
143855b662
Add better comment skipping () 2021-11-22 07:13:09 +13:00
ahkrr
e06df124ca
upgrading dependencies ()
* 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 () 2021-11-19 17:30:27 +13:00
Fernando Herrera
88988dc9f4
Plugins signature load ()
* 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 () 2021-11-19 08:32:27 +13:00
Jakub Žádník
f8f437b060
Separate Overlay into its own thing ()
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 () 2021-11-16 21:53:03 +13:00
Jakub Žádník
5459d30a24
Add environment variable support for modules ()
* 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 () 2021-11-16 07:33:33 +13:00