Commit Graph

890 Commits

Author SHA1 Message Date
Benoît Cortier
1c15a4ed3a
docs: clarify print and echo commands (#5909)
I thought this comment was relevant:
https://github.com/nushell/nushell/issues/5724#issuecomment-1148164153
2022-06-29 18:43:46 -04:00
Darren Schroeder
0827ed143d
cleanup $config as a built-in (#5852) 2022-06-22 13:13:03 -05:00
Darren Schroeder
128ce6f9b7
update reedline config based on recent reedline changes (#5845) 2022-06-21 12:22:11 -05:00
WindSoilder
fab3f8fd40
fix exit code (#5835)
* fix exit code

* fix usage

* add comment
2022-06-20 09:05:11 -05:00
Kangaxx-0
5f0ad1d6ad
Fix alias completion crash (#5814)
* Solve crash - commit 1

* commit 2 with issue

* Fix corner case

* Unit tests

* Fix windows tests
2022-06-17 07:50:10 -05:00
pwygab
8d7bb9147e
Attempts to fix file completions for open, rm and ls (and other filesystem commands) (#5805)
* fixes the issue for 'open' and other commands that explicitly use `SyntaxShape::Filepath`

* fixes for `rm` and similar commands

* fixes for `ls`: potentially breaking?

* fmt

* a curious fix to the test

* a curious fix to the test, except for Windows this time

* fixes Windows tests failing

* resolves it by putting an explicit check for `ls`

* reverts unnecessary test changes; fmt

* changes the order of completion operations
2022-06-17 07:47:43 -05:00
phiresky
42dbfd1fa0
SQLite History MVP with timestamp, duration, working directory, exit status metadata (#5721)
This PR adds support for an SQLite history via nushell/reedline#401

The SQLite history is enabled by setting history_file_format: "sqlite" in config.nu.

* somewhat working sqlite history
* Hook up history command
* Fix error in SQlitebacked with empty lines

When entering an empty line there previously was the "No command run"
error with `SqliteBackedHistory` during addition of the metadata

May be considered a temporary fix

Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-06-14 22:53:33 +02:00
Kangaxx-0
534e1fc3ce
Add NU config to allow user be able to turn off external completion (#5773)
* 06-07-wsl

* 06-07-linux-issue-with-delete-input

* 06-08-2023

* 06-08-Linux

* commit for merge

* Fix unit test

* format

* clean code

* Add flag to turn off external completion

* change env var to config

* Fix comment

Co-authored-by: Frank Zhang <v-frankz@microsoft.com>
2022-06-14 14:28:11 -05:00
Fernando Herrera
11d7d8ea1e
Remove dfr from dataframe commands (#5760)
* input and output tests

* input and output types for dfr

* expression converter

* remove deprecated command

* correct expressions

* cargo clippy

* identifier for ls

* cargo clippy

* type for head and tail expression

* modify full cell path if block
2022-06-12 14:18:00 -05:00
WindSoilder
c5cb369d8d
While starting nu, force PWD to be current working directory (#5751)
* fix current working directory during start

* fix tests

* always set PWD to current_dir
2022-06-10 13:01:08 -05:00
Kangaxx-0
b6959197bf
Support completion for alias and sub-command (#5749)
* 06-07-wsl

* 06-07-linux-issue-with-delete-input

* 06-08-2023

* 06-08-Linux

* commit for merge

* Fix unit test

* format

* clean code

Co-authored-by: Frank Zhang <v-frankz@microsoft.com>
2022-06-10 12:59:15 -05:00
Fernando Herrera
d5b99ae316
input and output types (#5750)
* input and output types

* added description

* type from stored variable

* string in custom value

* more tests with non custom
2022-06-10 10:59:35 -05:00
WindSoilder
2e0b964d5b
handle SIGQUIT (#5744)
* handle sigquit

* fix clippy
2022-06-09 07:08:15 -05:00
Justin Ma
64efa30f3e
fix: normalize some parameter names (#5725) 2022-06-06 09:42:13 -05:00
Jae-Heon Ji
820a6bfb08
feat: add search terms to category of strings (#5723) 2022-06-06 08:47:09 -05:00
Stefan Holderbach
e5d38dcff6
Address lints from clippy for beta/nightly (#5709)
* Fix clippy lints in tests

* Replace `format!` in `.push_str()` with `write!`

Stylistically that might be a bit rough but elides an allocation.

Fallibility of allocation is more explicit, but ignored with `let _ =`
like in the clippy example:

https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

* Remove unused lifetime

* Fix macro crate relative import

* Derive `Eq` for `PartialEq` with `Eq` members

https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

* Remove unnnecessary `.to_string()` for Cow<str>

* Remove `.to_string()` for `tendril::Tendril`

Implements `Deref<Target = str>`
2022-06-04 18:47:36 +12:00
Stefan Holderbach
0c16464320
Use search terms in the help menu search (#5708)
Currently only `help --find` was using the search terms.  With this change they will also be used by the `F1` help menu
2022-06-03 20:30:36 +02:00
Per Bothner
7a9bf06005
Minor fixes to shell integation in repl. (#5701)
Added CMD_FINISHED_MARKER to be emitted when command finishes.
Also switched the names PRE_EXECUTE_MARKER and PRE_PROMPT_MARKER
as the old names were confusing/wrong.
2022-06-02 17:57:19 -05:00
Darren Schroeder
0594f9e7aa
add case_sensitive_completions config option (#5646) 2022-05-26 09:22:20 -05:00
Herlon Aguiar
a42d419b66
nu-cli/completions: fix filter for variable completions (#5641) 2022-05-25 19:10:46 -05:00
Stefan Holderbach
0e1bfae13d
Fallback for config.buffer_editor from EDITOR (#5614)
For the reedline `buffer_editor` use the `EDITOR` and `VISUAL`
environment variables as fallback.

Same resolution order as #5607

Closes #5430
2022-05-23 05:32:52 +12:00
JT
a3a9571dac
Add environment change hook (#5600)
* add environment change hook

* clippy
2022-05-21 09:49:42 +12:00
WindSoilder
6efd1bcb3f
Don't report error when cwd is not exists. (#5590)
* only set cwd for child process if cwd exists, and avoid showing error when pwd is not exists

* better comment text

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2022-05-20 07:03:03 -05:00
Stefan Holderbach
0ea7a38c21
Move help menu to canonical F1 binding (#5510)
Currently the fully fledged help menu is bound to `Ctrl-Q`.
Help is widely associated with `F1`.

Before merging check that it is passed through on all platforms and
terminal emulators
2022-05-19 08:24:04 -05:00
Ian Manske
ac30b3d108
Fix menu panic for empty examples. (#5581) 2022-05-19 10:04:56 +02:00
Darren Schroeder
f0cb2f38df
refactor all write_alls to ensure flushing (#5567) 2022-05-17 13:28:18 -05:00
Darren Schroeder
f26d3bf8d7
make print flush (#5566) 2022-05-17 09:27:12 -05:00
Reilly Wood
f818193b53
Change history menu keybinding from ctrl+x to ctrl+r (#5507)
* Change history menu keybinding to ctrl+r from ctrl+x

* Remove menupage actions from default config

* remove trailing whitespace

* re-add next+previous page keybindings

* Remove hardcoded menu keybindings

* Hardcode new keybindings
2022-05-13 09:26:14 -05:00
Robert O'Shea
1aec4a343a
Made a change to completion resolution order (#5440)
* Made a change to completion resolution order

* Potential fix for completion (remove file paths from command completer)

* Updating formatting

* Removed commented out code for readability

* Fixed compile error on merge
2022-05-13 08:15:24 -05:00
Darren Schroeder
53e35670ea
add the ability to change table mode when running script (#5520) 2022-05-12 07:27:44 -05:00
Herlon Aguiar
a92567489f
nu-cli/completions: verify case for matching dir, .nu, file and command (#5506)
* nu-cli/completions: verify case for matching dir, .nu, file and command

* avoid copy

* fix clippy
2022-05-11 16:16:52 -05:00
Darren Schroeder
0b95465ea1
add --table_mode -m parameter (#5513)
* add `--table_mode` `-m` parameter

* underscores to dashes
2022-05-11 16:15:31 -05:00
Darren Schroeder
94a9380e8b
adjust where prompt markers go (#5491)
* adjust where prompt markers go

* marks are working, yipee!
2022-05-10 16:33:18 -05:00
Herlon Aguiar
8218f72eea
nu-cli/completions: added tests for dotnu completions (#5460) 2022-05-10 13:18:18 -05:00
JT
54fc164e1c
Allow hooks to be lists of blocks (#5480) 2022-05-09 13:56:48 +12:00
JT
3a35bf7d4e
Add hooks to cli/repl (#5479)
* Add hooks to cli/repl

* Clippy

* Clippy
2022-05-09 07:28:39 +12:00
Jakub Žádník
07ac3c3aab
Add Nushell REPL simulator; Fix bug in overlay add (#5478)
* Add Nushell REPL simulator; Fix bug in overlay add

The `nu_repl` function takes an array of strings and processes them as
if they were REPL lines entered one by one. This helps to discover bugs
due to the state changes between the parse and eval stages.

* Fix REPL tests on Windows
2022-05-08 16:09:39 +03:00
Jakub Žádník
9b99b2f6ac
Overlays (#5375)
* WIP: Start laying overlays

* Rename Overlay->Module; Start adding overlay

* Revamp adding overlay

* Add overlay add tests; Disable debug print

* Fix overlay add; Add overlay remove

* Add overlay remove tests

* Add missing overlay remove file

* Add overlay list command

* (WIP?) Enable overlays for env vars

* Move OverlayFrames to ScopeFrames

* (WIP) Move everything to overlays only

ScopeFrame contains nothing but overlays now

* Fix predecls

* Fix wrong overlay id translation and aliases

* Fix broken env lookup logic

* Remove TODOs

* Add overlay add + remove for environment

* Add a few overlay tests; Fix overlay add name

* Some cleanup; Fix overlay add/remove names

* Clippy

* Fmt

* Remove walls of comments

* List overlays from stack; Add debugging flag

Currently, the engine state ordering is somehow broken.

* Fix (?) overlay list test

* Fix tests on Windows

* Fix activated overlay ordering

* Check for active overlays equality in overlay list

This removes the -p flag: Either both parser and engine will have the
same overlays, or the command will fail.

* Add merging on overlay remove

* Change help message and comment

* Add some remove-merge/discard tests

* (WIP) Track removed overlays properly

* Clippy; Fmt

* Fix getting last overlay; Fix predecls in overlays

* Remove merging; Fix re-add overwriting stuff

Also some error message tweaks.

* Fix overlay error in the engine

* Update variable_completions.rs

* Adds flags and optional arguments to view-source (#5446)

* added flags and optional arguments to view-source

* removed redundant code

* removed redundant code

* fmt

* fix bug in shell_integration (#5450)

* fix bug in shell_integration

* add some comments

* enable cd to work with directory abbreviations (#5452)

* enable cd to work with abbreviations

* add abbreviation example

* fix tests

* make it configurable

* make cd recornize symblic link (#5454)

* implement seq char command to generate single character sequence (#5453)

* add tmp code

* add seq char command

* Add split number flag in `split row` (#5434)

Signed-off-by: Yuheng Su <gipsyh.icu@gmail.com>

* Add two more overlay tests

* Add ModuleId to OverlayFrame

* Fix env conversion accidentally activating overlay

It activated overlay from permanent state prematurely which would
cause `overlay add` to misbehave.

* Remove unused parameter; Add overlay list test

* Remove added traces

* Add overlay commands examples

* Modify TODO

* Fix $nu.scope iteration

* Disallow removing default overlay

* Refactor some parser errors

* Remove last overlay if no argument

* Diversify overlay examples

* Make it possible to update overlay's module

In case the origin module updates, the overlay add loads the new module,
makes it overlay's origin and applies the changes. Before, it was
impossible to update the overlay if the module changed.

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
Co-authored-by: pwygab <88221256+merelymyself@users.noreply.github.com>
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
Co-authored-by: WindSoilder <WindSoilder@outlook.com>
Co-authored-by: Yuheng Su <gipsyh.icu@gmail.com>
2022-05-08 07:39:22 +12:00
Herlon Aguiar
b0647f780d
nu-cli/completions: send original line to custom completer (#5459) 2022-05-06 16:58:42 -05:00
Darren Schroeder
2dfd975940
add -n flag to print to print without a newline (#5458)
* add -n flag to print to print without a newline

* clippy
2022-05-06 15:33:00 -05:00
WindSoilder
e14e60dd2c
make cd recornize symblic link (#5454) 2022-05-06 10:39:48 -05:00
Darren Schroeder
78a1879e36
fix bug in shell_integration (#5450)
* fix bug in shell_integration

* add some comments
2022-05-05 10:10:03 -05:00
Fernando Herrera
6a972312d4
added open editor event in config parsing (#5426) 2022-05-04 07:52:53 +12:00
JT
e36649f74b
Update path completions to handle spaces (#5419) 2022-05-03 12:37:38 +12:00
Richard
ab98ecd55b
Fix erroneous removal of "./" folder prefix (#5416) 2022-05-02 12:36:18 -05:00
Yuheng Su
bb27b9f371
Don't resuggest accepted completions (#5369)
To avoid resuggesting the same completion, add a space after commands or flags that have been accepted via `Enter`. Don't do that for filepaths or external completions

* Add append_whitespace choice for suggestion

Signed-off-by: gipsyh <gipsyh.icu@gmail.com>

* Fixed `test <path>` appending space.

* Update reedline

Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-05-02 11:35:37 +02:00
JT
96f8691c8d
More escaping/unescaping fixes (#5403) 2022-05-02 09:49:31 +12:00
JT
98ab31e15e
Move uses of trim_quotes to unescape for filenames (#5398)
* Move uses of trim_quotes to unescape for filenames

* Fix Windows tests
2022-05-02 06:37:20 +12:00
Reilly Wood
5077242892
Error printing changes for watch (#5389)
* Move CliError to nu-protocol

clean up comment

* Enable printing errors instead of just returning them

* Nicer Miette error printing in watch command
2022-05-01 19:33:41 +12:00
Richard
07893e01c1
Remove "./" prefix for file path completions (#5387) 2022-04-30 16:54:04 -05:00