Commit Graph

1709 Commits

Author SHA1 Message Date
JT
3d0b1ef1ce
Highlight help tutor (#838)
* WIP

* Syntax highlight help, add tutor
2022-01-25 02:05:19 +11:00
JT
525ed7653f
Add var vals and alias expansions to scope var (#837)
* Add var vals and alias expansions to scope var

* Fix test
2022-01-25 01:19:38 +11:00
JT
af52def93c
Fix doc comments for custom commands (#815) 2022-01-22 13:24:47 -05:00
JT
b58aad5eb0
Make external app error uniform (#812) 2022-01-23 01:12:34 +11:00
Darren Schroeder
2df37d6ec2
seed cmd_duration_ms (#798)
* seed cmd_duration_ms

* tweak
2022-01-21 13:50:44 -06:00
Stefan Holderbach
0651e2b31f
Upgrade reedline for partial hint completion (#802) 2022-01-22 06:21:22 +11:00
JT
939745ad67
Support recursive functions in capture (#797) 2022-01-21 11:39:55 -05:00
JT
f44954da68
Add CMD_DURATION_MS (#794) 2022-01-22 01:53:49 +11:00
Fernando Herrera
846a048bba
menu-performance (#793) 2022-01-21 08:59:29 +00:00
JT
ac07d93b02
let prompt env vars take strings (#790)
* let prompt env vars take strings

* clippy

* clippy
2022-01-21 13:22:03 +11:00
JT
69b2ed5566
bump reedline (#788) 2022-01-20 18:58:48 -05:00
JT
724cfaa890
Bump reedline (#785) 2022-01-20 13:57:47 -05:00
JT
45b3592739
add some more division for units (#783) 2022-01-21 05:23:26 +11:00
Darren Schroeder
54ed82a19a
completeness, make case-insensitive (#780) 2022-01-20 06:20:00 -06:00
JT
d2d22815fb
Improve env shorthand parse (#777) 2022-01-20 01:58:12 +11:00
Fernando Herrera
6514a30b5d
general keybindings (#775)
* general keybindings

* get value function

* check error for keybinding

* cmd and send for keybingins

* better error message
2022-01-19 07:28:08 -06:00
Fernando Herrera
ff9d88887b
simple event keybinding (#773) 2022-01-18 19:32:45 +00:00
Fernando Herrera
20eb348896
simple keybinding parsing (#768) 2022-01-18 08:48:28 +00:00
Darren Schroeder
ac36f32647
remove dialoguer completions in favor of reedline's (#766) 2022-01-17 09:51:44 -06:00
Fernando Herrera
89d99db94f
menu options (#748) 2022-01-15 17:01:44 +00: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
bc1e1aa944
Clippy fixes for Rust 1.58 (#733)
* Clippy fixes for Rust 1.58

* Try different message
2022-01-14 06:40:25 +11:00
Fernando Herrera
58c5ea4937
menu with tab (#724) 2022-01-12 10:57:37 +00: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
Fernando Herrera
47495715a6
context menu with nucompleter (#722) 2022-01-11 21:53:42 +00:00
Michael Angerman
160339bd1f
add in a new select test that exercises a different match arm of the select command (#718) 2022-01-10 13:29:52 -08:00
JT
d3bfc61524
Don't panic on alias errors (#713) 2022-01-10 13:52:01 +11:00
JT
4860014cec
silly keymap addition for quick shell changing (#710) 2022-01-10 09:17:58 +11:00
JT
f016a5cb72
Fix short flags with extra (#696) 2022-01-07 08:06:54 +11:00
JT
3478f35330
Default the values of named params (#695) 2022-01-07 07:32:47 +11:00
Fernando Herrera
8a0d2b4e32
double prompt (#686)
* double prompt

* prompt env var name
2022-01-06 12:57:55 +00:00
JT
cc1ae969fe
Allow int/float to coerce in type checker (#679) 2022-01-06 07:58:58 +11:00
JT
f71e16685c
Add shells support to auto-cd (#674) 2022-01-05 21:48:55 +11:00
JT
affb9696c7
Fix directory change lag (#672) 2022-01-05 16:50:27 +11:00
JT
c158d29577
Add shells support (#671) 2022-01-05 15:35:50 +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
Jakub Žádník
74dcd91cc3
Use only $nu.env.PWD for getting the current directory (#587)
* Use only $nu.env.PWD for getting current directory

Because setting and reading to/from std::env changes the global state
shich is problematic if we call `cd` from multiple threads (e.g., in a
`par-each` block).

With this change, when engine-q starts, it will either inherit existing
PWD env var, or create a new one from `std::env::current_dir()`.
Otherwise, everything that needs the current directory will get it from
`$nu.env.PWD`. Each spawned external command will get its current
directory per-process which should be thread-safe.

One thing left to do is to patch nu-path for this as well since it uses
`std::env::current_dir()` in its expansions.

* Rename nu-path functions

*_with is not *_relative which should be more descriptive and frees
"with" for use in a followup commit.

* Clone stack every each iter; Fix some commands

Cloning the stack each iteration of `each` makes sure we're not reusing
PWD between iterations.

Some fixes in commands to make them use the new PWD.

* Post-rebase cleanup, fmt, clippy

* Change back _relative to _with in nu-path funcs

Didn't use the idea I had for the new "_with".

* Remove leftover current_dir from rebase

* Add cwd sync at merge_delta()

This makes sure the parser and completer always have up-to-date cwd.

* Always pass absolute path to glob in ls

* Do not allow PWD a relative path; Allow recovery

Makes it possible to recover PWD by proceeding with the REPL cycle.

* Clone stack in each also for byte/string stream

* (WIP) Start moving env variables to engine state

* (WIP) Move env vars to engine state (ugly)

Quick and dirty code.

* (WIP) Remove unused mut and args; Fmt

* (WIP) Fix dataframe tests

* (WIP) Fix missing args after rebase

* (WIP) Clone only env vars, not the whole stack

* (WIP) Add env var clone to `for` loop as well

* Minor edits

* Refactor merge_delta() to include stack merging.

Less error-prone than doing it manually.

* Clone env for each `update` command iteration

* Mark env var hidden only when found in eng. state

* Fix clippt warnings

* Add TODO about env var reading

* Do not clone empty environment in loops

* Remove extra cwd collection

* Split current_dir() into str and path; Fix autocd

* Make completions respect PWD env var
2022-01-05 09:30:34 +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
4d1ce6c27b
Use default prompt as fallback (#663) 2022-01-05 06:49:04 +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
ffaaa53526
Plugin before config (#642)
* Add fuzzy/ignore flag to get

* Handle plugins before config
2022-01-02 14:20:33 +11:00
JT
f7e3d4de24
Add fuzzy/ignore flag to get (#641) 2022-01-02 13:18:39 +11:00
Darren Schroeder
a56994ccc5
make prompt indicators configurable (#639)
* make prompt indicators configurable

* seems to be working now
2022-01-02 09:53:16 +11:00
JT
ac487dfcbc
Add parser tracing, fix 629 (#638) 2022-01-02 08:42:50 +11:00
JT
4383b372f5
Cleanup binary stream print a little (#637) 2022-01-01 21:42:15 +11:00
Michael Angerman
5d58f68c59
port over from nushell the column flag for the length command (#617)
* port over from nushell the column flag for the length command

* fix clippy error

* refactor with the get_columns now centrally located
2022-01-01 15:27:20 +11:00
nibon7
15b0424d73
Create config directory if it does not exist (#625)
Signed-off-by: nibon7 <nibon7@163.com>
2021-12-30 21:47:51 +11:00
JT
e94b8007c1
Allow update to also insert (#610) 2021-12-28 10:11:20 +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
5c94528fe2
create history file if it doesnt exit (#605) 2021-12-28 06:14:23 +11:00
Fernando Herrera
53330c5676
def argument check (#604)
* def argument check

* corrected test

* clippy error
2021-12-28 06:13:52 +11:00
Michael Angerman
f50f37c853
fix issue #559: to json -r serializes datetime without spaces (#596)
* fix issue #559: to json -r serializes datetime without spaces

* add in a third test which checks spaces in both keys and values

* fix clippy error
2021-12-27 21:51:38 +11:00
JT
3706bef0a1
Require let to be a statement (#594) 2021-12-27 14:04:22 +11:00
JT
e1c92e90ca
Add line ending autodetect to 'lines' (#589) 2021-12-27 10:11:18 +11:00
JT
e62e0fb679
Flush stmts (#584)
* Flush the stmt via table to the screen

* Fix test
2021-12-27 07:21:24 +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
JT
d603086d2f
Fix custom call scope leak, refactor tests (#580)
* Fix custom call scope leak, refactor tests

* Actually add tests
2021-12-26 06:39:42 +11:00
JT
a811eee6b8
Add support for 'open' (#573) 2021-12-25 06:24:55 +11:00
JT
3522bead97
Add string stream and binary stream, add text decoding (#570)
* WIP

* Add binary/string streams and text decoding

* Make string collection fallible

* Oops, forgot pretty hex

* Oops, forgot pretty hex

* clippy
2021-12-24 18:22:11 +11:00
Darren Schroeder
29c8b826d4
add configuration point for hint coloring (#564) 2021-12-23 15:02:57 -06:00
Darren Schroeder
ba1ff4cf6c
add configuration of maximum history size (#563) 2021-12-23 13:59:00 -06:00
Fernando Herrera
f3c175562d
vi mode (#561) 2021-12-23 09:31:16 +00:00
Michael Angerman
5d3b63fa90
add in a raw flag in the command to json (#555)
* add in the method to_string_raw

* add in a raw flag to json

* add in a test
2021-12-23 06:56:49 +11:00
JT
9fb12fefb0
Improve history hinting (#551) 2021-12-22 20:12:24 +11:00
Jakub Žádník
deeb1da359
Allow having only one env conversion (#548)
Allows setting only `from_string` or `to_string` in `env_conversions`
config. Previously, both were required.
2021-12-22 00:32:38 +02:00
Jakub Žádník
52dba91e1a
Wrap captured env var names into quotes as well (#546) 2021-12-21 23:31:30 +02:00
Ștefan
a93a9b9029
Add skip-empty flag to lines command (#543)
* Add skip-empty flag to lines command

* Fix failing length test
2021-12-22 07:24:11 +11:00
JT
fc7ed1bfe4
switch substring to bytes (#538)
* switch substring to bytes

* Add a test
2021-12-21 11:49:02 +11:00
Jakub Žádník
1609101e62
Fix capturing environment variables with " or ' (#537)
* Fix path expand error span

* Fix capturing env vars containing ' or "; Rustfmt
2021-12-20 23:19:43 +02:00
JT
152467a858
Flatten should flatten embedded table (#534) 2021-12-21 06:03:18 +11:00
JT
caf73c36f2
Finish adding support for optional params (#530) 2021-12-20 17:58:09 +11:00
JT
2883d6cd1e
Remove Span::unknown (#525) 2021-12-19 18:46:13 +11:00
Michael Angerman
00bb203756
add in a new command called columns (#519) 2021-12-18 12:14:28 -06:00
Jakub Žádník
ada9c742c6
Fix broken env var reading on startup (#513) 2021-12-17 23:09:44 +02:00
Ștefan
6f6340186a
Port flatten (#512)
* A first working version of flatten. Needs a lot of cleanup. Committing to have a working version

* Typo fix

* Flatten tests pass

* Final cleanup, ready for push

* Final cleanup, ready for push

* Final cleanup, ready for push

* Final cleanup, ready for push

* Update flatten.rs

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
2021-12-18 07:44:51 +11:00
Jakub Žádník
6a0f404558
Treating environment variables as Values (#497)
* Proof of concept treating env vars as Values

* Refactor env var collection and method name

* Remove unnecessary pub

* Move env translations into a new file

* Fix LS_COLORS to support any Value

* Fix spans during env var translation

* Add span to env var in cd

* Improve error diagnostics

* Fix non-string env vars failing string conversion

* Make PROMPT_COMMAND a Block instead of String

* Record host env vars to a fake file

This will give spans to env vars that would otherwise be without one.
Makes errors less confusing.

* Add 'env' command to list env vars

It will list also their values translated to strings

* Sort env command by name; Add env var type

* Remove obsolete test
2021-12-17 12:04:54 +11:00
Stefan Holderbach
efb4a9f95c
Fix Ctrl-D exit in cli (#508)
Clears to a new line for the potentially hosting process
Remove the output for `Ctrl-C`
2021-12-16 15:40:12 -06:00
Stefan Holderbach
bf6780967b
Make dialoguer completion abortable (#507)
Fixes #505
2021-12-16 15:11:06 -06: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
Michael Angerman
1cbb785969
port over from nushell drop column (#495)
* port over from nushell drop column

* fix clippy
2021-12-15 06:54:27 +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
2013e9300a
Make config default if broken (#482)
* Make config default if broken

* Make config default if broken
2021-12-13 14:16:51 +11: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
4d7dd23779
Plugin json (#474)
* json encoder

* thread to pass messages

* description for example
2021-12-12 11:50:35 +00:00
Darren Schroeder
5c27ffa42e
update to latest reedline, change config point name, enable output without ansi (#458) 2021-12-09 16:06:26 -06:00
Darren Schroeder
3dc19d4179
Filesize formatting (#456)
* configure the format of filesize

* type-o

* removed some comments

* updated tests

* accomodated filesize_metric better, added test
2021-12-09 13:19:36 -06:00
Darren Schroeder
512dcf0988
enable cargo build --features=extra to build plugins (#448) 2021-12-07 14:06:34 -06:00
JT
fdde95f675
Update clippy to check all features (#441)
* Update clippy to check all features

* Fix tests

* oops
2021-12-06 07:23:43 +13:00
Michael Angerman
03e22b071a
port over the reject command from nushell (#419)
* port over reject

* add some tests to src/tests
2021-12-05 16:09:45 +13:00
JT
ddd8c3d9dc
Improve running main (#431) 2021-12-05 07:02:53 +13:00
JT
3e0c5e55b6
Add simple commandline args for scripts (#427) 2021-12-05 06:06:17 +13:00
Fernando Herrera
8a06ea133b
removed unwraps (#430) 2021-12-04 12:38:21 +00:00
JT
eed22605ef
Fix the failure if the prompt breaks (#426) 2021-12-04 18:24:38 +13:00
JT
8cf4402e6c
Reset ansi more often when showing errors (#425) 2021-12-04 18:02:57 +13:00
Darren Schroeder
bef138232c
this fixes garbage ansi when externals turn off vt processing (#422)
* this fixes garbage ansi when externals turn off vt processing

* clippy

* changes are only for windows

* type-o
2021-12-03 13:49:25 -06: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
574d7f6936
Add table streaming (#413) 2021-12-03 19:15:23 +13:00
JT
ccd5f59314
Update external spawn (#406)
* Simplify external spawn, improve arg cleaning

* Fix tests

* Fix windows test
2021-12-03 09:55:16 +13:00
JT
071066b6d9
Move prompt animation setting to config (#400) 2021-12-02 20:10:40 +13:00
JT
45eba8b922
Introduce metadata into the pipeline (#397) 2021-12-02 18:59:10 +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
Stefan Holderbach
3916ac4165
Fix busy poll with reedline (#387)
Fixes #386

Makes the changes to accept https://github.com/nushell/reedline/pull/188

Change CLI option EQ_PROMPT_ANIMATE_MS to binary EQ_PROMPT_ANIMATE
2021-11-30 09:59:54 -06: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
Darren Schroeder
6d58e2b51e
enable env setting for prompt animation (#376)
* enable env setting for prompt animation

* default to on

* updated comment
2021-11-28 15:09:52 -06:00
JT
5d88ed6c75
Add better exit command (#369) 2021-11-26 21:00:57 +13:00
JT
143855b662
Add better comment skipping (#359) 2021-11-22 07:13:09 +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
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
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
568e566adf
Add record literal syntax (#326) 2021-11-11 12:14:00 +13:00
JT
bb1740d733
Add from csv and from tsv (#320) 2021-11-10 09:17:37 +13:00
JT
34617fabd9
Do some str collect cleanup (#312) 2021-11-09 17:46:26 +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
19645575d6
Add 'did you mean' error (#305) 2021-11-08 10:48:50 +13:00
JT
00a8752c76
Move where to helper (#302) 2021-11-07 15:40:44 +13:00
JT
6c31377c21
Fix precedence parse (#298) 2021-11-06 20:31:28 +13:00
JT
d401ed64ed
Add range to the math reductions (#296) 2021-11-06 20:12:08 +13:00
JT
02b8027749
Improve external output in subexprs (#294) 2021-11-06 18:50:33 +13:00
JT
183d200b9f Add updating cell paths 2021-11-05 16:59:12 +13:00
JT
1949ba080e Add env shorthand 2021-11-04 15:32:35 +13:00
JT
5e42b14026 Documenting some code and doing cleanups 2021-11-03 08:53:48 +13:00
JT
25846d3c1e Add zip command 2021-11-02 18:28:28 +13:00
JT
d856cebebd Add a simple scope variable 2021-11-02 16:08:05 +13: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
b340672331 Remove leftover test from previous iteration 2021-10-31 18:01:15 +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
2dcfecbbd7 Add test for multi-word alias 2021-10-29 23:57:33 +03:00
JT
cf3f3fde92 Add some support for 2021-10-30 07:15:17 +13:00
JT
bac8b8a450 Add initial ctrl-c support 2021-10-28 17:13:10 +13:00
JT
f92e9d25a5 Make the history path more central 2021-10-28 13:30:58 +13: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
Jakub Žádník
595fc7a7f6 Switch to cross-platform fail message 2021-10-26 21:03:12 +03:00
Jakub Žádník
402a4acd7a Fix leftover test 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
JT
5455270446 Add a simple parallel each 2021-10-26 14:30:53 +13:00
JT
4be61ce604 Tests pass 2021-10-26 11:18:45 +13:00
JT
5d19017603 WIP 2021-10-26 05:58:58 +13:00
JT
baac60a5a7 WIP 2021-10-25 19:42:38 +13:00
JT
b5965ee8ef WIP 2021-10-25 19:31:39 +13:00
Darren Schroeder
7ef5a7945f clippy take2 2021-10-15 15:52:03 -05:00
Darren Schroeder
e330fdabb7 updated theme + clippy 2021-10-15 15:42:36 -05:00
Darren Schroeder
c9439c962b allow esc and q to get out of completions 2021-10-15 15:33:56 -05:00
JT
82b0415d92 Try out select completions from dialoguer 2021-10-16 07:37:58 +13:00
JT
fdd2c35fd9 Add the default help flag 2021-10-14 06:53:27 +13:00
JT
a760e46c1c Add config file loading 2021-10-13 16:57:05 +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
c8277a3da9 Do rest args 2021-10-12 16:28:39 +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
JT
0d031636a9 Error on missing column during cell path 2021-10-12 08:55:14 +13:00
JT
576471cc3c Fix test 2021-10-12 08:33:09 +13:00
JT
0504a7a776 Make errors emit first 2021-10-12 06:35:40 +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
d5fdfdb614 Add missing test attribute 2021-10-09 19:40:47 +02: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
d3bc096d47 Handle reverse ranges
This is really ugly and should be refactored.
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
5d36d37d20 Merge branch 'main' into fix_for 2021-10-10 05:20:50 +13:00
JT
e4ce41ba15 Fix the for loop to create vars 2021-10-10 05:10:46 +13:00
Fernando Herrera
a1bfa2788c not found message for windows 2021-10-09 16:44:45 +01:00
JT
5c29a83a7a Add tests 2021-10-09 15:45:25 +13:00
JT
f80e9d4b60
Merge pull request #91 from nushell/list_completions
Use list completions and better expansion
2021-10-05 10:44:26 +13:00
JT
7c2bf68d45 Use list completions and better expansion 2021-10-05 10:37:32 +13:00
Jakub Žádník
1e1e12b027 Fmt 2021-10-04 22:17:18 +03:00
Jakub Žádník
0fe525de87 Add test with TODO note 2021-10-04 20:16:43 +03:00
Jakub Žádník
4dacfaa44a Add import pattern support to 'hide' 2021-10-04 20:08:24 +03:00
JT
1d7ab28a0f
Merge pull request #74 from kubouch/module-export
Modules: export & hide
2021-10-03 06:25:43 +13:00
JT
eba3484611
Update tests.rs 2021-10-03 06:17:51 +13:00
JT
0cc121876b
Update tests.rs
Update test errors to be more portable
2021-10-03 06:12:05 +13:00
Jakub Žádník
81cd03626d
Merge branch 'main' into module-export 2021-10-02 18:53:35 +03:00
Fernando Herrera
03339beae1 prompt with env variable 2021-10-02 14:10:28 +01:00
JT
63a0aa6088 Let strings be cell paths 2021-10-02 18:43:43 +13:00
JT
6b76dd7cd7 Add select 2021-10-02 17:55:05 +13:00
JT
5843acec02 Add wrap and get and cell_path parsing 2021-10-02 15:59:11 +13:00
Jakub Žádník
2c1b074bdc Add test for double def 2021-10-02 00:21:08 +03:00
Jakub Žádník
fb0f83e574 Disallow hiding the same def twice; Add tests
Tests got removed after rebase.
2021-10-02 00:12:30 +03:00
Jakub Žádník
8ed6afe1e5 Fix tests failing without export 2021-10-01 23:24:57 +03:00
Jakub Žádník
a16144baf1 Disable crossterm raw mode
Without this change, the output of panic messages by miette would ignore
newlines and become unreadable.
2021-10-01 19:42:23 +03:00
JT
3e232a5db8 Add 'from json' 2021-10-01 18:11:49 +13:00
JT
0108a935ed add import lists 2021-09-27 13:23:22 +13:00
JT
abb0d7bd22 Add support for module imports 2021-09-27 07:39:19 +13:00
Fernando Herrera
d9c42eb194 contents declaration 2021-09-25 17:28:15 +01:00
Fernando Herrera
6387401041 clippy error 2021-09-25 17:03:25 +01:00
Fernando Herrera
dadc354847 move print to function 2021-09-25 16:58:50 +01:00
Fernando Herrera
637e4f6e6d simplify command call 2021-09-25 15:58:04 +01:00
Fernando Herrera
b12a265f1e writing to stdout 2021-09-25 15:56:33 +01:00
Fernando Herrera
cf60f72452 table as string output 2021-09-25 15:47:23 +01:00
JT
0ccbebee7a multiline validation 2021-09-22 17:29:53 +12:00
JT
d1474c0691 Show entry number in error 2021-09-22 15:14:57 +12:00
Kat Marchán
32f39c2fb8
use miette's new panic hook 2021-09-21 12:47:52 -07: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
Michael Angerman
b6fdf611f6 more block param and build string tests 2021-09-13 09:32:03 -07:00
JT
32c1f0c8d4 better it detection and block params in shapes 2021-09-13 19:54:13 +12:00
JT
abda6f148c Finish up completions 2021-09-10 10:09:40 +12:00
JT
bb6781a3b1 Add row conditions 2021-09-10 09:47:20 +12:00
JT
b821b14987 Add simple completions support 2021-09-09 21:06:55 +12:00
JT
6dd9f05ea1 Add an experimental record iteration 2021-09-08 10:00:20 +12:00
JT
2904002008 Make reedline prompt more resilient 2021-09-07 19:41:52 +12:00
JT
6af3affee2 add a test and update TODO 2021-09-07 19:09:49 +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
f91d0d6d65 merge main 2021-09-07 06:07:41 +12:00
JT
4ce9a5c894 Make variable assignment convert streams to full values 2021-09-07 06:05:46 +12:00
Michael Angerman
3534bd8a64 some build-string tests 2021-09-06 09:05:53 -07:00
JT
3b99ce71a0 add simple value iteration 2021-09-06 16:16:32 +12:00
JT
96b0edf9b0 range iteration 2021-09-06 16:07:48 +12:00
JT
979faf853a Block params 2021-09-06 14:20:02 +12:00
Fernando Herrera
b3d287815d updated dependencies 2021-09-05 20:06:57 +01: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
c4c4d82bf4 Try putting streams in Value 2021-09-02 09:20:53 +12:00
JT
08014c6a98
Move sys, ps, fetch, post to internal commands (#3983)
* Move sys, ps, fetch, post to internal commands

* Remove old plugins

* clippy

Co-authored-by: JT <jonatha.d.turner@gmail.com>
2021-09-01 14:29:09 +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
JT
ceea7e5aeb Remove lifetime from eval state 2021-08-16 14:30:31 +12:00
JT
579814895d Fix up eval params and refactor 2021-08-16 10:33:34 +12:00
JT
7655b070df fix tests 2021-08-11 06:57:08 +12:00
JT
1355a5dd33 refactor to subcrates 2021-08-11 06:51:08 +12:00
Jonathan Turner
f62e3119c4 a little more progress on errors 2021-08-10 18:31:34 +12:00
Jonathan Turner
828585a312 add more type helpers and span fixes 2021-08-10 17:55:25 +12:00
Jonathan Turner
ef4af443a5 parser fixes for windows and pretty errors 2021-08-10 17:08:10 +12:00
JT
1a3e1e0959 touchup alias highlight 2021-08-09 20:00:16 +12:00
JT
40004e64a6 Merge branch 'main' of github.com:jonathandturner/engine-q 2021-08-09 19:55:22 +12:00
JT
50dc0ad207 aliases 2021-08-09 19:55:06 +12:00
JT
3da4f02ffa aliases 2021-08-09 19:53:06 +12:00
Jonathan Turner
1ba80224ad More gracefully handle reedline errors 2021-08-09 17:29:25 +12:00
JT
bf19918e3c begin aliases 2021-08-09 12:19:07 +12:00
JT
38fef28c84 Add subcommand test 2021-08-09 09:55:18 +12:00
JT
273f964293 slight improvement 2021-08-09 09:34:21 +12:00
JT
d2577acccd env vars 2021-08-09 09:02:47 +12:00
JT
d92e661253 Adding floating point 2021-08-09 08:21:21 +12:00
JT
cb11f042ab Start env shorthand 2021-07-31 17:20:40 +12:00
JT
b82a4869d5 Add test 2021-07-31 16:25:26 +12:00
JT
c2be740ad4 def predecl 2021-07-31 16:04:42 +12:00
JT
61258d03ad add more tests 2021-07-31 09:57:22 +12:00
JT
79a05d63c8 add more tests 2021-07-31 09:26:05 +12:00
JT
18752672d0 add more tests 2021-07-31 08:02:16 +12:00
JT
cdc37bb142 fix eval bug 2021-07-30 20:06:48 +12:00
JT
083dcd4541 Better for loop 2021-07-30 19:50:39 +12:00
JT
b6f00d07e8 Fix var decl. improve for loop 2021-07-30 19:30:11 +12:00
JT
b0ffaf1c91 add for loop and benchmark 2021-07-30 18:10:40 +12:00
JT
2af61bd07e add correct eval scope 2021-07-30 17:42:33 +12:00
JT
1caae90c02 cleanup some highlighting 2021-07-30 16:43:31 +12:00
JT
184125a70a cleanup some highlighting 2021-07-30 16:38:41 +12:00
JT
53314cb8b2 slightly better coloring 2021-07-30 15:33:33 +12:00
JT
b5e287e065 WIP string interp 2021-07-30 15:26:06 +12:00
JT
2eeceae613 fix clippy, add strings and concat 2021-07-30 10:56:51 +12:00
JT
ad48387aa0 WIP 2021-07-24 18:44:38 +12:00
JT
a4bcc1ff3d WIP 2021-07-24 17:57:17 +12:00
JT
fca3a6b75e Support adding variables 2021-07-24 09:46:55 +12:00
JT
6fcdc76059 Improve call eval and live check 2021-07-24 09:19:30 +12:00
JT
3eefa6dec8 start expanding eval 2021-07-23 17:14:49 +12:00
JT
8c6feb7e80 Fix up global span logic 2021-07-23 08:45:23 +12:00
JT
37f8ff0efc Add highlighting 2021-07-23 07:50:59 +12:00
JT
07c22c7e81 Start working on highlighter 2021-07-22 19:48:45 +12:00
JT
1ac0c0bfc5 Move to refcell for permanent parser state 2021-07-22 19:33:38 +12:00
JT
c25209eb34 Fix running multiple times, add reedline 2021-07-22 18:04:50 +12:00
JT
4deed7c836 improve subcommand parse 2021-07-18 07:40:39 +12:00
JT
92f72b4103 add subcommand parsing 2021-07-18 07:34:43 +12:00
JT
30f54626d3 add companion short flags 2021-07-18 06:52:50 +12:00
JT
3a8206d1fb fix parser merge. start highlighter 2021-07-17 18:31:34 +12:00
JT
6b0b8744c1 Fix assignment parse 2021-07-17 17:28:25 +12:00
JT
0b8352049c Add pipelines 2021-07-17 15:42:08 +12:00
JT
c03f700662 Add rest param 2021-07-17 11:22:01 +12:00
JT
d08f2e73d0 Add optional params 2021-07-17 10:53:45 +12:00
JT
aa7f23e1e1 Simple short flag parse 2021-07-17 10:39:30 +12:00
JT
4249c5b3e0 Add param descriptions 2021-07-17 10:31:36 +12:00
JT
6f1a5c8e02 Remove lexmode 2021-07-17 10:11:15 +12:00
JT
03a93bd089 Improve colon sep 2021-07-17 10:00:41 +12:00
JT
6aef00ecff basic signature parse 2021-07-17 09:55:12 +12:00
JT
949c6a5932 intern blocks sooner 2021-07-17 08:26:40 +12:00
JT
7922bb4020 More decl parsing 2021-07-16 18:24:46 +12:00
JT
697bf16f26 Start moving towards decls and add a simple eval 2021-07-16 13:10:22 +12:00
JT
9916f35b22 cleanup 2021-07-09 18:23:20 +12:00
JT
0a6f62bc0e proper list/table guards 2021-07-09 09:45:56 +12:00
JT
bc974a3e7d cleanup 2021-07-09 09:31:08 +12:00
JT
1aa70c50aa refactor positional arg parse 2021-07-09 09:16:25 +12:00
JT
134b45dc03 refactor long/short flags 2021-07-09 08:29:00 +12:00
JT
96c0b933d9 Add parameterized list parsing 2021-07-08 19:49:17 +12:00
JT
7b51c5c49f Add alias and external 2021-07-08 19:20:01 +12:00
JT
eac02b55f6 some cleanup 2021-07-08 18:57:24 +12:00
JT
5d4ae4a2a4 drive let from internal call 2021-07-08 18:19:38 +12:00
JT
04cbef3aa8 Improve keyword detecting for call parsing 2021-07-08 17:30:36 +12:00
JT
e540f0ad26 start adding row expr parsing 2021-07-08 10:55:46 +12:00
JT
bf1a23afcf Add table parsing 2021-07-06 13:48:45 +12:00
JT
04a6a4f860 Add list parsing 2021-07-06 10:58:56 +12:00
JT
a6e0f0bb74
Revert "Revert "Removed file_id in Span, compact file sources"" 2021-07-03 15:35:15 +12:00
JT
80e0cd4e00
Revert "Removed file_id in Span, compact file sources" 2021-07-03 15:11:24 +12:00
JT
d644a8d41f trimming structs 2021-07-03 13:37:27 +12:00
JT
e0c2074ed5 trimming structs 2021-07-03 13:29:56 +12:00
JT
d8bf48e692 minor change 2021-07-03 07:30:03 +12:00
JT
a91efc3cbd blocks 2021-07-02 19:32:30 +12:00
JT
fb42c94b79 parens 2021-07-02 19:15:30 +12:00
JT
ba2e3d94eb math 2021-07-02 18:44:37 +12:00
JT
4ef65f0983 Add some tests 2021-07-02 14:22:54 +12:00
JT
2675ad9304 Add some tests 2021-07-02 13:42:25 +12:00
JT
c1240f214c Remove warnings. Improve unknown flags 2021-07-02 10:54:04 +12:00
JT
7f3eab418f Add call parsing 2021-07-02 10:40:08 +12:00
JT
4f89ed5d66 little bits of progress 2021-07-01 18:09:55 +12:00
JT
43fd0b6ae9 Add var usage 2021-07-01 13:31:02 +12:00
JT
e3abadd686 Add stmt parsing 2021-07-01 12:01:04 +12:00
JT
3d2e227f11 fix import 2021-06-30 13:47:19 +12:00
JT
29d2449fb3 first commit 2021-06-30 13:42:56 +12:00
JT
a74d05061d
Begin directory contrib docs and split commands (#3650)
* Begin directory contrib docs and split commands

* Fix unused import warning
2021-06-19 12:06:44 +12:00
Reagan McFarland
955a5ed8fb
Plugin: from_mp4 and UntaggedValue::duration fix (#3618)
* plugin: basic from_mp4 implementation

This patch introduces a very basic implementation of from_mp4, with only
a few bits of meta-data available. The rest of the available meta-data
(which is more than half left), will be included in a later patch

* Mp4: Almost all track metadata is implemented

Only meta-data that is not implemented is duration, facing some weird
issue I am going to check on later

* Mp4: All meta-data fields implemented

All meta-data fields that can be retrieved are now retrieved, with the
exception of duration for both tracks and the entire file itself because
there is still an issue. However, that will be fixed in the upcoming
patches

* fix: UntaggedValue::duration() serializes correctly now

Previous to this patch, there was an issue where when you would use
UntaggedValue::duration() it would result in an invalid JSONRPC
resulting string when using the protocol. This patch fixes this issue

* Mp4: Duration fixed for file and tracks

* plugins: Add plugin extra to src/plugins

* Mp4: Replace unwrap() with expect()

* Fix: Remove test mp4 file
2021-06-17 14:18:31 +12:00
Andrés N. Robalino
7c7e5112ea
Make Nu bootstrap itself from main. (#3619)
We've relied on `clap` for building our cli app bootstrapping that figures out the positionals, flags, and other convenient facilities. Nu has been capable of solving this problem for quite some time. Given this and much more reasons (including the build time caused by `clap`) we start here working with our own.
2021-06-15 17:43:25 -05:00
JT
a021b99614
Improve external quoting logic (#3579)
* Add tests and improve quoting logic

* fmt

* Fix clippy ling

* Fix clippy ling
2021-06-09 08:59:53 +12:00
Darren Schroeder
ea5bf9db36
add query json plugin for experimentation (#3327)
* add query json plugin for experimentation

* add some error handling

* closer but Kind::Array is still horked

* unravel the table so the output looks right

* clippy

* added the ability to use gjson modifiers
2021-04-19 11:19:06 -05:00
Michael Nitschinger
e8bc319f08
Make sure that scripts can also have custom commands. (#3309)
With the current code it is possible to attach custom commands from
a custom binary, but only for interactive mode. This change makes
it possible to also customize the evaluation context for commands
and scripts.
2021-04-15 06:21:50 +12:00
Jonathan Turner
073e5727c6
Switch to "engine-p" (#3270)
* WIP

* WIP

* first builds

* Tests pass
2021-04-06 11:19:43 -05:00
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
Leonhard Kipp
28e1a7915d
Impl one configurable function to run scripts (#3242)
* Impl one func to run scripts

* Add exit_on_err

* Remove run_standalone

* Make the compiler happy :)
2021-04-04 07:31:53 +12:00
Leonhard Kipp
c42b588782
Refactor nu-cli/env* (#3041)
* Revert "History, more test coverage improvements, and refactorings. (#3217)"

This reverts commit 8fc8fc89aa.

* Add tests

* Refactor .nu-env

* Change logic of Config write to logic of read()

* Fix reload always appends to old vars

* Fix reload always takes last_modified of global config

* Add reload_config in evaluation context

* Reload config after writing to it in cfg set / cfg set_into

* Add --no-history to cli options

* Use --no-history in tests

* Add comment about maybe_print_errors

* Get ctrl_exit var from context.global_config

* Use context.global_config in command "config"

* Add Readme in engine how env vars are now handled

* Update docs from autoenv command

* Move history_path from engine to nu_data

* Move load history out of if

* No let before return

* Add import for indexmap
2021-03-31 18:52:34 +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
Jonathan Turner
0d305d7c3e
Lines no longer treats a text buffer as a line (#3153) 2021-03-11 11:35:15 +13:00
Michael Angerman
d06f457b2a
nu-cli refactor moving commands into their own crate nu-command (#2910)
* move commands, futures.rs, script.rs, utils

* move over maybe_print_errors

* add nu_command crate references to nu_cli

* in commands.rs open up to pub mod from pub(crate)

* nu-cli, nu-command, and nu tests are now passing

* cargo fmt

* clean up nu-cli/src/prelude.rs

* code cleanup

* for some reason lex.rs was not formatted, may be causing my error

* remove mod completion from lib.rs which was not being used along with quickcheck macros

* add in allow unused imports

* comment out one failing external test; comment out one failing internal test

* revert commenting out failing tests; something else might be going on; someone with a windows machine should check and see what is going on with these failing windows tests

* Update Cargo.toml

Extend the optional features to nu-command

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2021-01-12 17:59:53 +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
5a75e11b0e
Revert "Getting closer to multiline scripts (#2738)" (#2745)
This reverts commit e66bf70589.
2020-11-10 18:22:13 +13:00
Jonathan Turner
e66bf70589
Getting closer to multiline scripts (#2738)
* Begin allowing comments and multiline scripts.

* clippy

* Finish moving to groups. Test pass
2020-11-10 16:52:42 +13:00
Darren Schroeder
97f3671e2c
web scraping with css selectors (#2725)
* first step of making selector

* wip

* wip tests working

* probably good enough for a first pass

* oops, missed something.

* and something else...

* grrrr version errors
2020-11-03 15:46:42 -06:00
Darren Schroeder
a2cc2259e7
add bson and sqlite to wix (#2668)
* add bson and sqlite to wix

* add sqlite and bson from and to
2020-10-14 04:46:06 -05:00
Andrés N. Robalino
4e931fa73f
Extract out xpath to a plugin. (#2661) 2020-10-12 18:18:39 -05:00
Andrés N. Robalino
ddf9d61346
Line charts. Chart plugin sub command extraction. (#2627) 2020-10-01 19:23:10 -05:00
Andrés N. Robalino
a56abb6502
Bar Chart baseline. (#2621)
Bar Chart ready.
2020-09-30 13:27:52 -05:00
Jonathan Turner
8453261211
Update rustyline to latest (#2565)
* Update rustyline to latest

* Go ahead and use rustyline for testing
2020-09-17 18:02:30 +12:00
Andrés N. Robalino
10d4edc7af
Slim down configuration readings and nu_cli clean up. (#2559)
We continue refactoring nu_cli and slim down a bit configuration
readings with a naive metadata `modified` field check.
2020-09-16 18:22:58 -05: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
Jonathan Turner
371a951668
Split extra (#2348)
* Split default/extra plugins

* Oops, too many deletes

* Pipelines
2020-08-14 16:45:27 +12:00
Antonio Yang
88555860f3
Fetch content from S3 (#2328)
* fetch content from s3 resource

* remove submodule

* fix clippy

* update Cargo.lock

* fix s3 plugin dependency version
2020-08-13 05:20:22 +12:00
Rajasekharan Vengalil
f14c0df582
Allow disabling welcome message on launch (#2314)
* Implements #2313
2020-08-09 11:38:21 +12:00
Andrés N. Robalino
ad43ef08e5 Support average for tables. 2020-05-30 10:33:09 -05:00
Andrés N. Robalino
fe01a223a4 Str plugin promoted to built-in Nu command. 2020-05-28 11:18:58 -05:00
Jason Gedge
005d76cf57
Fix broken ordering of args when parsing command with env vars. (#1841) 2020-05-24 19:26:27 -04:00
Andrés N. Robalino
f18424a6f6 Remove test-bins feature. 2020-05-17 23:32:55 -05:00
Jonathan Turner
076fde16dd
Evaluation of command arguments (#1801)
* 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
Michael Nitschinger
e7f08cb21d
Allow external binary to register custom commands. (#1780)
This changeset contains everything that a separate binary needs to
register its own commands (including the new help function). It is
very possible that this commit misses other pub use exports, but
the contained ones work for our use cases so far.
2020-05-14 12:35:22 +12:00
Jonathan Turner
0f0847e45b
Move 'start' to use ShellError (#1743)
* Move 'start' to use ShellError

* Remove unnecessary changes

* Add missing macOS change

* Add default

* More fixed

* More fixed
2020-05-10 08:08:53 +12:00
Elton Leander Pinto
ccd5d69fd1
Bug fix start (#1738)
* fix bug on linux; added start to the stable list

* add to stable and fix clippy lint
2020-05-10 05:28:57 +12:00
Jonathan Turner
59d516064c
Add alias support to scripts and -c (#1593) 2020-04-16 05:50:35 +12:00
Andrés N. Robalino
21a543a901
Make sum plugin as internal command. (#1501) 2020-03-18 18:46:00 -05:00
Andrés N. Robalino
d3718d00db
Merge shuffle nu plugin as core command. (#1475) 2020-03-10 17:00:08 -05:00
Andrés N. Robalino
f88674f353
Nu internals are logged under nu filter. (#1451) 2020-03-05 05:18:53 -05: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
Andrés N. Robalino
c731a5b628
Columns can be renamed. (#1447) 2020-03-03 16:01:24 -05:00
Falco Hirschenberger
ed7d3fed66
Add shuffle plugin (#1443)
* Add shuffle plugin

see #1437

* Change plugin to integrate into nu structure and build system
2020-03-03 08:44:12 +13: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
Benjamin Röjder Delnavaz
eabfa2de54
Let ls ignore permission errors (#1435)
* Create a function to create an empty directory entry

* Print an empty directory entry if permission is denied

* Fix rustfmt whitespace issues.

* Made metadata optional for `dir_entry_dict`.

Removed `empty_dir_entry_dict` as its not needed anymore.
2020-02-29 14:33:52 +13:00
equal-l2
c43a58d9d6
Fix incorrect display for zero-size files (#1422) 2020-02-19 09:57:58 -05:00
Sean Hellum
b98f893217
add a touch command (#1399) 2020-02-19 09:54:32 +13:00
Jonathan Turner
afce2fd0f9
Revert "Display rows in the same table regardless of their column order given they are equal. (#1392)" (#1401)
This reverts commit 4fd9974204.
2020-02-17 17:34:37 -08:00
Andrés N. Robalino
4fd9974204
Display rows in the same table regardless of their column order given they are equal. (#1392) 2020-02-16 20:35:01 -05:00
Shaurya Shubham
71615f77a7
Fix minor typo in calc command error (#1395) 2020-02-16 16:02:41 -05:00
Jonathan Turner
9bc5022c9c
Force a \n at the end of a stdout stream (#1391)
* Force a \n at the end of a stdout stream

* clippy
2020-02-14 18:15:32 -08:00
Jonathan Turner
8ae8ebd107
Add support for multiline script files (#1386)
* Add support for multiline script files

* clippy
2020-02-13 21:24:18 -08:00
Corvus Corax
96985aa692
Fix invalid shorthand flag (#1384) 2020-02-13 07:47:34 -08:00
Shaurya Shubham
c1bec3b443
Return error on a divide by zero (#1376)
Return error on a divide by zero
2020-02-12 08:38:04 -05:00
Corvus Corax
c0be02a434
Short-hand flags (#1378)
* typo fixes

* Change signature to take in short-hand flags

* update help information

* Parse short-hand flags as their long counterparts

* lints

* Modified a couple tests to use shorthand flags
2020-02-11 18:24:31 -08:00
Andrés N. Robalino
2ab8d035e6
External it and nu variable column path fetch support. (#1379) 2020-02-11 18:25:56 -05:00
Jonathan Turner
0b2be52bb5
Only add quotes if not in Windows (which adds its own?) (#1374)
* Only add quotes if not in Windows (which adds its own?)

* Only add quotes if not in Windows (which adds its own?)
2020-02-10 23:07:44 -08:00
Corvus Corax
6a371802b4
Add block size to du (#1341)
* Add block size to du

* Change blocks to physical size

* Use path instead of strings for file/directory names

* Why don't I just use paths instead of strings anyway?

* shorten physical size and apparent size to physical and apparent resp.
2020-02-10 12:32:18 -08:00
Andrés N. Robalino
29ccb9f5cd
Ensure stable plugins get installed. (#1373) 2020-02-10 15:32:10 -05:00
Jonathan Turner
fb532f3f4e
Prototype shebang support (#1368)
* Add shebang support to nu.

* Move test file

* Add test for scripts

Co-authored-by: Jason Gedge <jason.gedge@shopify.com>
2020-02-10 08:49:45 -08:00
Jason Gedge
a29d52158e
Do not panic when failing to decode lines from external stdout (#1364) 2020-02-10 07:37:48 -08:00
Jonathan Turner
dc50e61f26 Switch stdin redirect to manual. Add test (#1367) 2020-02-09 22:55:07 -08:00
Jonathan Turner
e606407d79
Add error codes to -c (#1361) 2020-02-08 20:04:53 -08:00
Jonathan Turner
5f4fae5b06 Pipeline sink refactor (#1359)
* Refactor pipeline ahead of block changes. Add '-c' commandline option

* Update pipelining an error value

* Fmt

* Clippy

* Add stdin redirect for -c flag

* Add stdin redirect for -c flag
2020-02-08 18:24:33 -08:00
Jason Gedge
3687603799
Only spawn external once when no $it argument (#1358) 2020-02-08 17:57:05 -08:00
George Tsomlektsis
643b532537
Fixed mv not throwing error when the source path was invalid (#1351)
* Fixed mv not throwing error when the source path was invalid

* Fixed failing test

* Fixed another lint error

* Fix $PATH conflicts in .gitpod.Dockerfile (#1349)

- Use the correct user for gitpod Dockerfile.
- Remove unneeded packages (curl, rustc) from gitpod Dockerfile.

* Added test to check for the error

* Fixed linting error

* Fixed mv not moving files on Windows. (#1342)

Move files correctly in windows.

* Fixed mv not throwing error when the source path was invalid

* Fixed failing test

* Fixed another lint error

* Added test to check for the error

* Fixed linting error

* Changed error message

* Typo and fixed test

Co-authored-by: Sean Hellum <seanhellum45@gmail.com>
2020-02-07 12:40:48 -05:00
George Tsomlektsis
ed86b1fbe8
Fixed mv not moving files on Windows. (#1342)
Move files correctly in windows.
2020-02-07 11:24:01 -05:00
Alex van de Sandt
e3be849c2a
Futures v0.3 upgrade (#1344)
* Upgrade futures, async-stream, and futures_codec

These were the last three dependencies on futures-preview. `nu` itself
is now fully dependent on `futures@0.3`, as opposed to `futures-preview`
alpha.

Because the update to `futures` from `0.3.0-alpha.19` to `0.3.0` removed
the `Stream` implementation of `VecDeque` ([changelog][changelog]), most
commands that convert a `VecDeque` to an `OutputStream` broke and had to
be fixed.

The current solution is to now convert `VecDeque`s to a `Stream` via
`futures::stream::iter`. However, it may be useful for `futures` to
create an `IntoStream` trait, implemented on the `std::collections` (or
really any `IntoIterator`). If something like this happends, it may be
worthwhile to update the trait implementations on `OutputStream` and
refactor these commands again.

While upgrading `futures_codec`, we remove a custom implementation of
`LinesCodec`, as one has been added to the library. There's also a small
refactor to make the stream output more idiomatic.

[changelog]: https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md#030---2019-11-5

* Upgrade sys & ps plugin dependencies

They were previously dependent on `futures-preview`, and `nu_plugin_ps`
was dependent on an old version of `futures-timer`.

* Remove dependency on futures-timer from nu

* Update Cargo.lock

* Fix formatting

* Revert fmt regressions

CI is still on 1.40.0, but the latest rustfmt v1.41.0 has changes to the
`val @ pattern` syntax, causing the linting job to fail.

* Fix clippy warnings
2020-02-05 19:46:48 -08:00
Jonathan Turner
ba1b67c072
Attempt rustup update on each PR (#1345)
* Attempt update on each PR

* Update fmt
2020-02-05 19:28:49 -08:00
Jason Gedge
fa910b95b7
Have from-ssv not fail for header-only inputs (#1334) 2020-02-05 11:54:14 -08:00
Ishan Bhanuka
427bde83f7
Allow cp to overwrite existing files (#1339) 2020-02-05 01:54:05 -05:00
Ryan Blecher
c6da56949c
Add support for plugin names containing numbers (#1321)
* Add ability to have numbers in plugin name. Plugin must start with alphabetic char

* remove the first character as alphabetic requirement

* Update cli.rs

Going ahead and changing to plus to prevent issue notryanb found

* Update cli.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-02-01 22:08:38 -08:00
Alex
5b398d2ed2
Adding cross-platform kill command (#1326)
* Adding kill command, unclean code

* Removing old comments

* Added quiet option, supports variable number of ids

* Made it per_item_command, calling commands directly without the shell
2020-02-01 10:46:28 -08:00
Jason Gedge
dcdfa2a866
Improve tests and labeling in FilesystemShell (#1305)
Additional `ls` command tests and better FilesystemShell error and label messages.
2020-02-01 03:34:34 -05:00
Corvus Corax
9474fa1ea5
Improved code in du command (#1320)
Made the code a little easier to read
2020-02-01 03:32:06 -05:00
Andrés N. Robalino
3610baa227
Default plugins are independent and called from Nu. (#1322) 2020-01-31 17:45:33 -05:00
Andrés N. Robalino
4e201d20ca
Paths from Nu config take priority over external paths. (#1319) 2020-01-31 14:19:47 -05:00
Jonathan Turner
0bbd12e37f
Improve the default help message (#1313) 2020-01-30 20:13:14 -08:00
Shaurya Shubham
dc3370b103
Make a calc command (#1280) 2020-01-29 08:34:36 -05:00
Andrés N. Robalino
ac5ad45783
Pretty Nu print default, pretty print regular secondary as raw flag. (#1302) 2020-01-29 02:46:54 -05:00
Andrés N. Robalino
5b19bebe7d
Isolate environment state changes into Host. (#1296)
Moves the state changes for setting and removing environment variables
into the context's host as opposed to calling `std::env::*` directly
from anywhere else.

Introduced FakeHost to prevent environemnt state changes leaking
between unit tests and cause random test failures.
2020-01-29 00:40:06 -05:00
Joseph T. Lyons
2c529cd849
Fix bug where --with-symlink-targets would not display the targets column (#1300) 2020-01-28 21:36:20 -08:00