Commit Graph

70 Commits

Author SHA1 Message Date
JT
299fea8538
Fix external extra (#4777)
* Fix empty table from externals

* Fix empty table from externals
2022-03-07 20:17:33 -05:00
Justin Ma
1157fcf372
fix typo, update some examples and regenerate docs (#4718) 2022-03-04 06:10:09 -06:00
Jakub Žádník
d90b7953dd
Use Nushell's PATH in which (#4690)
* Make which use our path instead of std::env

* Unignore which test

* Fix wrong fn signature without which feature
2022-03-03 10:38:31 +02:00
JT
0c3ea636fb
Add support for stderr and exit code (#4647) 2022-02-25 14:51:31 -05:00
JT
e8a6458f0d
finish up with examples (#4637) 2022-02-25 05:19:25 -05:00
JT
3c62d27c28
Try again with math-like externals (#4629)
* Try again with math-like externals

* clippy 1.59

* clippy 1.59

* clippy 1.59
2022-02-24 14:02:28 -05:00
Michael Angerman
feb4f5c347
replace ValueStream with ListStream (#4621) 2022-02-24 06:57:31 -05:00
Fernando Herrera
21c0f7d738
allow int and float as strings for arguments (#4615)
* allow int and float as strings for arguments

* consume iterator
2022-02-24 05:09:02 +00:00
Fernando Herrera
c2bad71123
remove repeated function (#4600)
* remove repeated function

* name in signature
2022-02-22 08:13:38 -05:00
JT
9888f8f298
Add pipeline redirection support (#4594)
* redirection

* Remove commented-out

* fix tests

* more fixes
2022-02-21 17:22:21 -05:00
Justin Ma
3f14b75153
feat: add examples for length,lines,reject,benchmark and drop column (#4547) 2022-02-18 19:03:24 -06:00
JT
f5f9d56c37
Move to a standard kebab/snake style (#4509) 2022-02-17 09:55:17 -05:00
Michael Angerman
bd96ce4e9c
add more examples to the sys command (#4491) 2022-02-15 21:06:38 -08:00
JT
5c1a1be02b
Don't error on failed external expansion (#4480) 2022-02-15 08:47:25 -05:00
Jakub Žádník
328f7e92a0
Hide alias (#4432)
* Add alias interning

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

* Fix wrong message

* Fix using decl instead of alias

* Extend also alias id visibility

* Merge also aliases from delta

* Add alias hiding code

Does not work yet but passes tests at least.

* Fix wrong alias lookup and visibility appending

* Add hide alias tests

* Fmt & Clippy

* Fix random clippy warnings in "which" command
2022-02-12 11:50:37 +02:00
JT
a008f1aa80
Command tests (#922)
* WIP command tests

* Finish marking todo tests

* update

* update

* Windows cd test ignoring
2022-02-03 21:01:45 -05:00
Darren Schroeder
cbdc0e2010
Windows ps update (#909)
* query command with json, web, xml

* query xml now working

* clippy

* comment out web tests

* Initial work on query web

For now we can query everything except tables

* Support for querying tables

Now we can query multiple tables just like before, now the only thing
missing is the test coverage

* Revert "Query plugin"

* augment `ps -l` on windows to display more info

Co-authored-by: Luccas Mateus de Medeiros Gomes <luccasmmg@gmail.com>
2022-02-01 15:05:26 -06:00
JT
4c9df9c7c1
Add a fallback if Windows external spawn fails (#902)
* Add a fallback if Windows external spawn fails

* Remove path workaround

* More fixes

* More fixes

* Be more flexible with error tests
2022-01-31 12:42:12 -05:00
JT
d62716c83e
Use 'table' during internal->external (#898)
* Use 'table' during internal->external

* Preserve more of config
2022-01-31 07:52:05 -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
285f65ba34
Port exec command (#849)
* Port exec command

* fix windows

* lint
2022-01-26 04:27:35 +11:00
JT
1ca3e03578
Fix expanding external args (#847) 2022-01-26 00:11:35 +11:00
JT
62e9698b11
Allow external args to expand globs (#839)
* Allow external args to expand globs

* WIP

* A bit of cleanups and refactor to glob_from

* oops, add file
2022-01-25 05:26:56 +11:00
JT
bf9340ec48
Only escape backslash on windows (#825) 2022-01-22 18:35:52 -05:00
JT
b58aad5eb0
Make external app error uniform (#812) 2022-01-23 01:12:34 +11:00
JT
33ffb2c39a
Add which command, add external completions, and builtin var completions (#782)
* Add which and external completions

* WIP

* Finish up external and var completions

* fix windows
2022-01-21 05:02:53 +11:00
JT
8f4ee14d85
Hide Windows ps status, bump reedline (#749) 2022-01-16 06:44:24 +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
ca215c1152
Add nu-system and rewrite ps command (#734)
* Add nu-system and rewrite ps command

* Add more deps

* Add more deps

* clippy

* clippy

* clippy

* clippy

* clippy

* clippy
2022-01-14 17:20:53 +11:00
JT
82d90f4930
Add support for var/string interp for external names (#729) 2022-01-13 19:17:45 +11:00
JT
186da4d725
Fixing captures (#723)
* WIP fixing captures

* small fix

* WIP

* Rewrite to proof-of-concept better parse_def

* Add missing file

* Finish capture refactor

* Fix tests

* Add more tests
2022-01-12 15:06:56 +11:00
JT
b4c72e85e1
Limit when we expand external args (#668) 2022-01-05 12:09:53 +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
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
Jakub Žádník
8ba3e3570c
Interpret lists as series of args for externals (#550)
* Interpret lists as series of args for externals

* Fix clippy warnings
2021-12-22 10:13:05 +02:00
JT
2883d6cd1e
Remove Span::unknown (#525) 2021-12-19 18:46:13 +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
JT
906c0e6bca
Better filepath completions (#485) 2021-12-13 17:46:30 +11:00
JT
1336acd34a
Seems ps still needs a delay to be accurate (#484) 2021-12-13 16:28:35 +11: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
d1d1402512
Add in auto-cd if you pass just a directory (#479)
* Add in auto-cd if you pass just a directory

* clippy
2021-12-13 08:41:34 +11:00
Fernando Herrera
8a06ea133b
removed unwraps (#430) 2021-12-04 12:38:21 +00:00
JT
a28d38b05f
Try some fixes for external paths (#415) 2021-12-03 20:40:31 +13:00
JT
574d7f6936
Add table streaming (#413) 2021-12-03 19:15:23 +13:00