Commit Graph

288 Commits

Author SHA1 Message Date
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