Commit Graph

348 Commits

Author SHA1 Message Date
Stefan Stanciulescu
f169a9be3b
Add version as a flag (#4507) 2022-02-17 05:02:46 -06:00
JT
56b3fc61a3
Remove statements, replaced by pipelines (#4482) 2022-02-15 14:31:14 -05:00
JT
f3d3e819fb
Fix main in scripts with captures (#4468)
* Fix main in scripts with captures

* Remove old comments
2022-02-14 10:53:48 -05:00
Darren Schroeder
968ef1e953
add parameter to set thread count for parallel commands (#4424) 2022-02-11 12:46:36 -06:00
Darren Schroeder
f275644e13
add --perf cli param (#4391)
* add `--perf` cli param

* clippy

* fixed 2 `cp` tests on windows
2022-02-09 16:08:16 -06: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
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
JT
e91d8655c6
Only trim prompt (#876)
* Only trim the output for prompts

* Only remove the last newline
2022-01-28 18:22:09 -05:00
JT
4c029d2545
Automatically trim ends of stdin/stdout strings (#874) 2022-01-28 16:59:00 -05:00
JT
86eeb4a5e7
Fix a bad slice into erroring utf-8 buffer (#872) 2022-01-28 15:32:46 -05:00
JT
020ad24b25
"maybe text codec" version 2 (#871)
* Add a RawStream that can be binary or string

* Finish up updating the into's
2022-01-28 13:32:33 -05: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
3d0b1ef1ce
Highlight help tutor (#838)
* WIP

* Syntax highlight help, add tutor
2022-01-25 02:05:19 +11: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
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
Fernando Herrera
58c5ea4937
menu with tab (#724) 2022-01-12 10:57:37 +00:00
Fernando Herrera
47495715a6
context menu with nucompleter (#722) 2022-01-11 21:53:42 +00:00
JT
4860014cec
silly keymap addition for quick shell changing (#710) 2022-01-10 09:17:58 +11:00
Fernando Herrera
8a0d2b4e32
double prompt (#686)
* double prompt

* prompt env var name
2022-01-06 12:57:55 +00: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
4d1ce6c27b
Use default prompt as fallback (#663) 2022-01-05 06:49:04 +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
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
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
Fernando Herrera
5c94528fe2
create history file if it doesnt exit (#605) 2021-12-28 06:14:23 +11:00
JT
3706bef0a1
Require let to be a statement (#594) 2021-12-27 14:04:22 +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
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
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
2883d6cd1e
Remove Span::unknown (#525) 2021-12-19 18:46:13 +11:00
Jakub Žádník
ada9c742c6
Fix broken env var reading on startup (#513) 2021-12-17 23:09:44 +02: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
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
Darren Schroeder
5c27ffa42e
update to latest reedline, change config point name, enable output without ansi (#458) 2021-12-09 16:06:26 -06: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
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
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
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
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
02b8027749
Improve external output in subexprs (#294) 2021-11-06 18:50:33 +13:00
JT
5e42b14026 Documenting some code and doing cleanups 2021-11-03 08:53:48 +13:00
JT
d856cebebd Add a simple scope variable 2021-11-02 16:08:05 +13: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
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
a760e46c1c Add config file loading 2021-10-13 16:57:05 +13:00
JT
0504a7a776 Make errors emit first 2021-10-12 06:35:40 +13:00
JT
7c2bf68d45 Use list completions and better expansion 2021-10-05 10:37:32 +13:00
Fernando Herrera
03339beae1 prompt with env variable 2021-10-02 14:10:28 +01: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
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
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
2904002008 Make reedline prompt more resilient 2021-09-07 19:41:52 +12:00
Fernando Herrera
f7a19d37c6 one parser function 2021-09-06 21:41:30 +01: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
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
ef4af443a5 parser fixes for windows and pretty errors 2021-08-10 17:08:10 +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
273f964293 slight improvement 2021-08-09 09:34:21 +12:00
JT
d2577acccd env vars 2021-08-09 09:02:47 +12:00
JT
cb11f042ab Start env shorthand 2021-07-31 17:20:40 +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
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
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
3a8206d1fb fix parser merge. start highlighter 2021-07-17 18:31:34 +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
6aef00ecff basic signature parse 2021-07-17 09:55:12 +12:00