Commit Graph

2367 Commits

Author SHA1 Message Date
Darren Schroeder
b86c6db400
fix cal tests (#925)
* fix 1 test

* missed 1 test
2022-02-04 07:24:36 -06:00
Fernando Herrera
1e86af2fb9
list keybinding options (#906)
* list keybinding optins

* list keybinding options

* clippy error
2022-02-04 06:47:18 +00:00
JT
a008f1aa80
Command tests (#922)
* WIP command tests

* Finish marking todo tests

* update

* update

* Windows cd test ignoring
2022-02-03 21:01:45 -05:00
Darren Schroeder
3d3298290a
add case-insensitive sorting (#919) 2022-02-03 15:18:18 -06:00
Darren Schroeder
e1c28cf06b
add --du to ls command (#917) 2022-02-03 13:58:32 -06:00
Darren Schroeder
2f0bbf5adb
du command (#916)
* wip on `du` command

* working
2022-02-03 11:35:06 -06: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
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
Darren Schroeder
004d7b5ff0
query command with json, web, xml (#870)
* 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

* finish off

* comment out web test

Co-authored-by: Luccas Mateus de Medeiros Gomes <luccasmmg@gmail.com>
2022-02-01 12:45:48 -06:00
Darren Schroeder
c80a15cdfe
should be inclusive (#904)
* should be inclusive

* changed tests due to spans being different
2022-01-31 17:02:36 -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
96fedb47ee
Wait on the plugin child to prevent zombies (#901) 2022-01-31 10:20:11 -05:00
Ashish Thapa
b1aa8f4edf
Add strftime cheatsheet for into datetime (#869) (#883)
* Add strftime cheatsheet for `into datetime` (#869)

* proper table for strftime cheatsheet of `into datetime` (#883)
2022-01-31 07:32:35 -06: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
Andrés N. Robalino
def5869c1c
command(split-by) (#897) 2022-01-30 18:29:21 -05:00
Jakub Žádník
2fbd182993
Allow viewing the source code of blocks (#894)
* Add spans to blocks and view command

* Better description; Cleanup

* Rename "view" command to "view-source"
2022-01-31 00:05:25 +02:00
Julian Aichholz
67cb720f24
Port update cells command (#891)
* Port update cells command

Clean up, nicer match statements in UpdateCellsIterator

Return columns flag into HashSet errors

Add FIXME: for update cell behavior on nested lists

* Fix: process cells for Record when no columns are specified

* Fix: address clippy lints for unwrap and into_iter

* Fix: don't step into lists and don't bind $it var
2022-01-30 23:41:05 +02:00
JT
a51d45b99d
Ignore clippy's erroneous warnings (#895) 2022-01-30 16:12:41 -05:00
Access
1fd0ddb52c
Maybe solve the none bug? (#860)
* Maybe solve the none bug?

* cargo fmt

* use nothing, not string

* check at last

* I check it at last

* Use error which has span

* use not found error

* fix error

* use a empty value length?

* * Add commit about what I change and fmt

Now all test passed, but I do not know if it is right

* update the test

* check if it is nothing

* update commit

* Rename test

Co-authored-by: Jakub Žádník <kubouch@gmail.com>
2022-01-30 15:23:28 +02:00
JT
060a4b3f48
Port detect columns (#892) 2022-01-30 07:52:24 -05:00
Michael Angerman
95a5e9229a
add help --find to help doc (#890) 2022-01-30 05:54:15 -05:00
Stefan Stanciulescu
3c8716873e
Port rotate (#880)
* Add rotate command

* Add rotate counter clockwise

* Fix comments in the code

* Fix clippy warnings

* Fix comment

* Fix wrong step for non even table sizes

* Fix comment for moving through array

* Refactor rotate and have only one command with a --ccw flag for counter-clockwise rotation. By default, rotate is clockwise

* Update usage description
2022-01-29 15:47:28 -05:00
JT
44821d9941
Add support for def-env and export def-env (#887) 2022-01-29 15:45:46 -05:00
Darren Schroeder
dc6f1c496b
fixes process path being truncated (#885) 2022-01-29 08:50:48 -06:00
JT
65ae3160ca
Variables should error on use rather than value span (#881) 2022-01-29 08:00:48 -05:00
Stefan Stanciulescu
1a25970645
Port rename (#877)
* Port rename

* Update description

* Fix fmt issues

* Refactor the code a bit and move things around
2022-01-29 05:26:47 -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
e11ac9f6f8
Harden highlighter against alias spans (#867) 2022-01-28 07:29:45 -05:00
eggcaker
9926561dd7
Fix into datetime example parameter type (#862) 2022-01-28 00:06:07 +11:00
Fernando Herrera
267ff4b0cf
using menu trait (#861) 2022-01-27 07:53:23 +00:00
JT
04395ee05c
Allow equals to sep long flag and arg (#858) 2022-01-27 12:20:12 +11:00
JT
6f4b7efd3e
Also set $in-variable with input (#856)
* Also set in-variable with input

* Fix test

* Add more tests
2022-01-27 10:46:13 +11:00
Michael Angerman
a4421434d9
add support for Floats for sort-by (#857) 2022-01-26 14:44:37 -08:00
Stefan Stanciulescu
e8b8836977
Add suport for Filesize and Date for sort-by command (#855) 2022-01-26 13:54:31 -08:00
JT
78b5da8255
Allow let/let-env to see custom command input (#854) 2022-01-27 06:00:25 +11:00
JT
83ec374995
Add -c flag and others to cmdline args (#853)
* Add -c flag and others to cmdline args

* finish a little bit of cleanup

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

* WIP

* redirect working

* Add help and examples

* Only show flags in signature of more than help
2022-01-27 01:42:39 +11:00
JT
cdc8e67d61
Remove unused repo parts (#4271)
* Remove unused repo parts

* Update README

* cargo fmt
2022-01-26 07:31:04 +11:00
JT
285f65ba34
Port exec command (#849)
* Port exec command

* fix windows

* lint
2022-01-26 04:27:35 +11:00
JT
3023af66fd
Port default command (#848) 2022-01-26 02:02:15 +11:00
JT
1ca3e03578
Fix expanding external args (#847) 2022-01-26 00:11:35 +11:00
Stefan Stanciulescu
f4c0538653
Flatten records. Not thoroughly tested though (#845) 2022-01-25 23:07:37 +11:00
Fernando Herrera
69954a362d
history-menu (#846) 2022-01-25 09:39:22 +00:00
eggcaker
5c749fcc63
allow fetch command to add custom headers (#840) 2022-01-25 13:19:29 +11:00
JT
6e44012a2f
Fix bug in date comparison (#842) 2022-01-24 16:55:45 -05:00
JT
988a873466
Allow open to read its filename from input (#841)
* Allow `open` to read its filename from input

* Add examples
2022-01-25 08:04:28 +11:00
Jakub Žádník
53f41c1985
Port move (#833)
* Remove comment

* Fix merge not retaining LS_COLORS

* Add move command

* Add checking for non-existent columns

* Add move command examples; Disallow flag shorthand
2022-01-24 21:43:38 +02: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
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
Michael Angerman
8a1b2d0812
fix several cases where sort-by was crashing engine-q (#836) 2022-01-23 20:52:19 -08:00
Darren Schroeder
d4fb95a98c
allow find to respect ls_colors (#834) 2022-01-24 12:23:03 +11:00
Arthur Targaryen
f82e2fbac6
Port find command (#658)
* Add `Find` command

* Complete rustdoc for test `Value` constructors

* Use `Option::unwrap_or` instead of match

* Add `Value::test_filesize` constructor

* Handle searching for terms in `find`

* Fix `find` command signature

* Return multiple elements when `find`ing by predicate

* Do not accept rest parameter with predicate

* Handle `CellPath` in `r#in` and `not_in` for `Find`

* Use `PipelineData::filter`
2022-01-23 16:32:02 -06:00
Darren Schroeder
e11a030780
capture keyboard event (#832)
* capture keyboard event

* try a different strategy - still not working right

* fixed up
2022-01-23 16:09:39 -06:00
Stefan Stanciulescu
4e171203cc
Fix cd-ing into a file (#831)
* Add custom error for path not being a directory

* Fix cd issue with cd-ing into a file

* Keep formatting style as before

* Check if path is not a directory and return error if that's the case
2022-01-23 15:02:12 +02:00
Maxim Zhiburt
fd3eec81b5
Bump ansi-cut version to 0.2.0 (#822)
Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2022-01-22 18:36:40 -05:00
Darren Schroeder
3d40e169ce
fix to retain ls_colors coloring from ls (#824)
fixes #823
2022-01-22 18:36:27 -05:00
JT
bf9340ec48
Only escape backslash on windows (#825) 2022-01-22 18:35:52 -05:00
JT
310ecb79b6
Add flag completions (#817) 2022-01-22 16:18:31 -05:00
Michael Angerman
89d852f76c
port sort_by without float (yet) (#814) 2022-01-22 12:49:50 -08:00
JT
af52def93c
Fix doc comments for custom commands (#815) 2022-01-22 13:24:47 -05:00
Darren Schroeder
6a446f708d
add hash base64 (#813) 2022-01-22 10:23:55 -06:00
Stefan Stanciulescu
afe83104c6
Fix flatten's dropping column issue #756 (#805)
* Fix flatten's dropping column issue, and do some cleanup - better variable naming.

* Fix failing test

* Fix failing tests
2022-01-23 01:19:40 +11:00
JT
b58aad5eb0
Make external app error uniform (#812) 2022-01-23 01:12:34 +11:00
Jakub Žádník
564c2dd7d1
Port merge command from Nushell (#808)
* Add example test to zip

* Port merge command from Nushell

On top of the original merge, this one should not collect a stream
returned from the merged block and allows merging records.
2022-01-22 01:50:26 +02:00
Eli Flanagan
e1272f3b73
lint: remove trailing whitespace (#806) 2022-01-22 10:29:10 +11:00
JT
6fa022b0a8 Add group-by and transpose (aka pivot) (#803) 2022-01-21 15:28:21 -05:00
Darren Schroeder
0ef0277882
allow use to parse quoted paths (#800) 2022-01-21 13:20:13 -06:00
JT
939745ad67
Support recursive functions in capture (#797) 2022-01-21 11:39:55 -05:00
Fernando Herrera
846a048bba
menu-performance (#793) 2022-01-21 08:59:29 +00:00
Darren Schroeder
057bfff0cb
add term size command (#792)
* add `term-size` command

* Update term_size.rs

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
2022-01-21 14:31:33 +11:00
JT
91883bd572
Better help search (#789) 2022-01-20 18:58:58 -05:00
JT
b4e61a056c
add cd - support (#787) 2022-01-21 07:51:44 +11:00
Darren Schroeder
65ef7b630b
PATH for completions for each os (#784) 2022-01-20 13:46:52 -05:00
JT
45b3592739
add some more division for units (#783) 2022-01-21 05:23:26 +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
Michael Angerman
d4b6b4b09a
update all cargo crates to edition 2021 (#781) 2022-01-21 00:13:45 +11:00
JT
be8c905ca7
Show error on bad config, but keep going (#778) 2022-01-20 03:42:12 +11: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
JT
49e8af8ea5
Bump to 0.43 (#4264) 2022-01-18 12:06:12 -05:00
JT
d5d61d14b3
Tutor eq (#4263)
* Fix clippy lints

* Fix clippy lints

* Fix clippy lints

* Add e-q tutor page
2022-01-19 03:22:23 +11:00
JT
f562a4526c
Fix clippy lints (#4262)
* Fix clippy lints

* Fix clippy lints

* Fix clippy lints
2022-01-18 23:33:28 +11:00
Guillaume Gomez
e6c09f2dfc
Update sysinfo version (#4261) 2022-01-18 22:37:52 +11:00
Fernando Herrera
20eb348896
simple keybinding parsing (#768) 2022-01-18 08:48:28 +00:00
Darren Schroeder
2c75aabbfc
allow size and other to count bytes from binary with as_string() (#769) 2022-01-17 17:41:59 -06:00
Stefan Holderbach
01e691c5ba
Fix unicode word wrapping with ansi-cut (#767)
Ansi-cut expects ranges of character numbers (of the non-ansi control
sequence characters) instead of byte indices.
This fixes the panics when wrapping of non-unicode lines (which exceed
the demanded number of characters as byte indices).
Also rectifies some wrong wrapping of unicdoe containing lines that
don't panic
2022-01-17 15:31:21 -05:00
Darren Schroeder
085a7c18cb
fix signature (#765) 2022-01-17 09:14:33 -06:00
JT
0f85646d8e
Let 'to toml' output block source (#763) 2022-01-17 19:25:12 +11:00
Darren Schroeder
c55b6c5ed5
fix list formatting (#762) 2022-01-16 16:40:40 -06:00
JT
283a615ecc
Enter now requires a directory (#761) 2022-01-17 03:14:34 +11:00
JT
9b128b7a03
Add rest to get, bump reedline (#760) 2022-01-17 02:40:11 +11:00
Jakub Žádník
bfe3c50dce
Fix empty entry in ls (#759) 2022-01-17 02:40:00 +11:00
Onur Şahin
5fae96a6b1
Fix not equal returning error when same things are compared in some cases (#709)
* Fix not equal returning error when same things are compared in some cases

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

* Remove debugging print line

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

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

* Add canonicalize check and remove code clones

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

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

* Add single-dot expansion to nu-path

* Move value path expansion from parser to eval

Fixes #745

* Remove single dot expansion from parser

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

* Fix ls to display globs with relative paths

* Use pathdiff crate to get relative paths for ls

Co-authored-by: Stefan Stanciulescu <contact@stefanstanciulescu.com>
2022-01-17 00:55:56 +11:00
nibon7
746641edae
Port seq command (#755)
Signed-off-by: nibon7 <nibon7@163.com>
2022-01-17 00:52:41 +11:00
JT
fa5aab8170
Add simple stdin input command (#754)
* Add simple stdin input command

* Add binary input

* Tweak binary view
2022-01-16 15:28:28 +11:00
JT
b78924c777
Add support for load-env (#752) 2022-01-15 18:50:11 -05:00
JT
75db4a75bc
Save (#750)
* Add support for save

* Add support for binary filetypes
2022-01-16 07:44:20 +11:00
JT
8f4ee14d85
Hide Windows ps status, bump reedline (#749) 2022-01-16 06:44:24 +11: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
21a7278259
Revert "Fix ls relative path and erroring on fake dir (#697)" (#744)
This reverts commit bee5ba3deb.
2022-01-15 12:58:24 +02:00
Stefan Stanciulescu
bee5ba3deb
Fix ls relative path and erroring on fake dir (#697)
* 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
2022-01-15 12:30:39 +02:00
Darren Schroeder
a7241f9899
add seq_date command (#743)
* add `seq_date` command

* fixed a reedline type-o

* copy-n-paste error
2022-01-14 16:07:28 -06: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
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
JT
82d90f4930
Add support for var/string interp for external names (#729) 2022-01-13 19:17:45 +11:00
Darren Schroeder
d0f9943709
expose a few more types to custom commands (def) (#725) 2022-01-12 09:59:07 -06:00
JT
186da4d725
Fixing captures (#723)
* WIP fixing captures

* small fix

* WIP

* Rewrite to proof-of-concept better parse_def

* Add missing file

* Finish capture refactor

* Fix tests

* Add more tests
2022-01-12 15:06:56 +11:00
Fernando Herrera
47495715a6
context menu with nucompleter (#722) 2022-01-11 21:53:42 +00:00
Darren Schroeder
ffb086d56f
a little better table alignment (#720) 2022-01-11 08:49:15 -06: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
Jakub Žádník
733b2836f1
Cleanup parsing of use and hide commands (#705) 2022-01-10 12:39:25 +11:00
Darren Schroeder
3a17b60862
new command fmt to format numbers (#707)
* new command `fmt` to format numbers

* remove comments
2022-01-09 19:19:41 -06:00
Darren Schroeder
b49885bb85
Revert "added a better default for ls_colors (#703)" (#711)
This reverts commit d63eac69e5.
2022-01-09 16:48:29 -06:00
Michel Alexandre Salim
476d543dee
Update descriptions for crates split out from nu-cli (#4247)
`nu-command` and `nu-data` were split out, but the descriptions still
say 'CLI'.

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2022-01-09 06:05:50 -06:00
Darren Schroeder
d63eac69e5
added a better default for ls_colors (#703) 2022-01-08 08:30:48 -06:00
Darren Schroeder
38e0527083
add more chars (#701)
* add more chars

* group nerdfonts with nf- prefix

* labeled unicode weather symbols
2022-01-08 07:19:51 -06:00
Jakub Žádník
3b467bedd9
Add reduce command (#700)
* Add reduce command

* Fix example and missing test commands

* Add forgotten file
2022-01-08 02:40:40 +02:00
Jakub Žádník
f964ce9bc0
Add repository name and current tag to gstat (#692)
* Add repository name to gstat

* Fix getting repo name; Add tag as well
2022-01-07 05:44:05 -06: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
Jakub Žádník
eab6b322bb
Add CR, LF and CRLF to char command (#691) 2022-01-06 20:52:43 +02:00
Fernando Herrera
8a0d2b4e32
double prompt (#686)
* double prompt

* prompt env var name
2022-01-06 12:57:55 +00:00
JT
e44789556b
Fix path external (#684)
* Fix external invocation/expansion

* clippy
2022-01-06 21:20:31 +11:00
JT
d39e8c15fe
Expand external command names (#682) 2022-01-06 10:32:56 +11:00
Ștefan
47544ad219
Move fetch to extra and clean up some code (#664)
* Move fetch to extra

* Move byte stream code to a function instead of copying it twice

* Fix formatting issues

* Make fetch a default command

* Fix formatting
2022-01-06 10:06:16 +11:00
Jakub Žádník
d0c280f6cc
Fixes how environment is cloned inside tight loops (#678)
* Improve cd IO error

* Fix environment cloning in loops

* Remove debug print

* Fmt
2022-01-06 09:21:26 +11:00
JT
14cd798f00
Make ls more forgiving (#681) 2022-01-06 09:21:15 +11:00
JT
cc1ae969fe
Allow int/float to coerce in type checker (#679) 2022-01-06 07:58:58 +11:00
JT
3c2a336ef9
Each much clone its env (#675) 2022-01-05 23:08:03 +11:00
JT
058738c48c
More shell fixes (#673) 2022-01-05 17:36:42 +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
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
Darren Schroeder
4584d69715
tweak source parsing to allow quotes around string (#666) 2022-01-05 10:44:48 +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
857ecda050
Let describe know about binary (#662) 2022-01-04 14:05:24 +11:00
JT
36079f1a3d
Port fetch (with fixes) (#660)
* Port fetch to engine-q

* Fix check for path as a string

* Add a timeout flag and fix some span issues

* Add a temporary fetch command that returns byte streams. Got rid of async stuff as we're using the blocking feature of tokio

* More tweaks for the bytestream

* Rewrite fetch using ByteStreams

* buffer read on bytes directly

Co-authored-by: Stefan Stanciulescu <contact@stefanstanciulescu.com>
2022-01-04 13:01:18 +11:00
JT
b6fcd46075
Some error improvements (#659) 2022-01-04 10:14:33 +11:00