Commit Graph

971 Commits

Author SHA1 Message Date
Herlon Aguiar
b9eb213f36
nu-cli/completions: added completion for $nu (#5303) 2022-04-23 11:49:17 +12:00
Herlon Aguiar
5ff2ae628b
nu-cli: directory syntax shape + completions (#5299) 2022-04-22 15:18:51 -05:00
Herlon Aguiar
661283c4d2
nu-cli/completions: support record for custom completions (#5298) 2022-04-22 15:17:08 -05:00
JT
96253c69fb
Use better quoting for commandline args (#5271) 2022-04-21 15:31:52 +12:00
JT
ded9d1cedb
Some cleanups for clippy (#5266) 2022-04-21 12:08:12 +12:00
Arnout Engelen
1295495758
typo: seach -> search (#5264) 2022-04-21 07:38:24 +12:00
Stefan Holderbach
995d8db1fe
Set to reedline main branch for development cycle (#5249)
Changes to reedline since `v0.4.0`:

- vi normal mode `I` for inserting at line beginning
- `InsertNewline` edit command that can be bound to `Alt-Enter` if
desired to have line breaks without relying on the `Validator`
- `ClearScreen` will directly clear the visible screen. `Signal::CtrlL` has been
removed.
- `ClearScrollback` will clear the screen and scrollback. Can be used to
mimic macOS `Cmd-K` screen clearing. Helps with #5089
2022-04-20 21:10:33 +12:00
Herlon Aguiar
c0ce1e9057
nu-cli/completions: fix file completions with quotes (#5242)
* nu-cli/completions: fix file completions with quotes

* wrap with backticks
2022-04-20 16:54:37 +12:00
Herlon Aguiar
4d7b86f278
nu-cli: added tests for file completions (#5232)
* nu-cli: added tests for file completions

* test adding extra sort

* Feature/refactor completion options (#5228)

* Copy completion filter to custom completions

* Remove filter function from completer

This function was a no-op for FileCompletion and CommandCompletion.
Flag- and VariableCompletion just filters with `starts_with` which
happens in both completers anyway and should therefore also be a no-op.
The remaining use case in CustomCompletion was moved into the
CustomCompletion source file.

Filtering should probably happen immediately while fetching completions
to avoid unnecessary memory allocations.

* Add get_sort_by() to Completer trait

* Remove CompletionOptions from Completer::fetch()

* Fix clippy lints

* Apply Completer changes to DotNuCompletion

* add os to $nu based on rust's understanding (#5243)

* add os to $nu based on rust's understanding

* add a few more constants

Co-authored-by: Richard <Tropid@users.noreply.github.com>
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2022-04-20 16:54:00 +12:00
Richard
0de289f6b7
Feature/refactor completion options (#5228)
* Copy completion filter to custom completions

* Remove filter function from completer

This function was a no-op for FileCompletion and CommandCompletion.
Flag- and VariableCompletion just filters with `starts_with` which
happens in both completers anyway and should therefore also be a no-op.
The remaining use case in CustomCompletion was moved into the
CustomCompletion source file.

Filtering should probably happen immediately while fetching completions
to avoid unnecessary memory allocations.

* Add get_sort_by() to Completer trait

* Remove CompletionOptions from Completer::fetch()

* Fix clippy lints

* Apply Completer changes to DotNuCompletion
2022-04-19 13:59:10 -05:00
JT
76079d5183
Move config to be an env var (#5230)
* Move config to be an env var

* fix fmt and tests
2022-04-19 10:28:01 +12:00
Herlon Aguiar
dd1d9b7623
nu-cli/completions: completion for use and source (#5210)
* nu-cli/completions: completion for use and source

* handle subfolders for different base dirs

* fix clippy errors
2022-04-19 00:59:13 +12:00
Kat Marchán
1314a87cb0
update miette and switch to GenericErrors (#5222) 2022-04-19 00:34:10 +12:00
Marc Schreiber
a35b975d84
Shell Integration (#5162)
This commit renders ANSI chars in order to provide shell integrations
such Kitty's opening feature that captures the output of the last
command in a pager such as less.

Fixes #5138
2022-04-16 22:03:02 -05:00
Herlon Aguiar
cb3276fb3b
nu-cli/completions: removed unnecessary bool (#5207) 2022-04-16 13:34:38 +12:00
Tomoki Aonuma
c17129a92a
Fix env capture (#5205)
* Fix env capture

* Add test for env capture
2022-04-16 10:38:27 +12:00
JT
5bf1c98a39
Move to dev version 0.61.1 (#5206) 2022-04-16 09:29:30 +12:00
Herlon Aguiar
13b371ab58
nu-cli/completions: add completion for record vars (#5204) 2022-04-16 08:24:41 +12:00
Herlon Aguiar
2a3991cfdb
nu-cli/completions: add completion for $env. (#5199)
* nu-cli/completions: add completion for $env.

* use stack to avoid showing hidden env vars
2022-04-15 16:17:53 +03:00
Kat Marchán
3783c19d02
bump miette to 4.4.0 (#5167)
This fixes an issue where docsrs error links were not working.

Ref: https://github.com/zkat/miette/issues/147
2022-04-13 08:38:15 +12:00
JT
4566c904d0
Bump 0.61 (#5166) 2022-04-13 05:42:26 +12:00
Stefan Holderbach
9b020c056b
Pin reedline version for 0.61 release (#5164) 2022-04-13 04:38:36 +12:00
Stefan Holderbach
836f914163
Clean REPL code, hide Hints without ANSI coloring (#5157)
- With a change to reedline hints can now be hidden. This is useful when
no ANSI coloring is available as hints become indistinguishable from the
actual buffer
- remove commented out code
- order the logging calls according to the implementation
2022-04-12 06:19:42 +12:00
Reilly Wood
57761149f4
Update incorrect crate descriptions (#5159) 2022-04-12 06:17:06 +12:00
Stefan Holderbach
625e807a35
Support unbinding a particular key event (#5152)
To remove a default keybinding for a particular edit mode, set the `event: null`:

e.g. to disable screen clearing with Ctrl-L

```
let $config = {keybindings: [{
        modifier: control
        keycode: char_l
        mode: [emacs, vi_normal, vi_insert]
        event: null
      } ]}

```
2022-04-10 23:54:09 +02:00
Stefan Holderbach
d18f34daa4
Allow overriding of menu keybindings (#5148)
Keybindings that were attached to menus like `Ctrl-x` or `Ctrl-q` could not be replaced with custom bindings
2022-04-10 22:48:55 +02:00
Reilly Wood
58f395989a
Remove unused dependencies (#5145)
* Remove unused packages from base Cargo.toml

* Remove unused crossterm_winapi from nu-cli

* Remove unused dependencies from nu-system

* Remove unused dependencies from nu-test-support
2022-04-10 09:14:55 +12:00
Hristo Filaretov
683b912263
Track call arguments in a single list (#5125)
* Initial implementation of ordered call args

* Run cargo fmt

* Fix some clippy lints

* Add positional len and nth

* Cargo fmt

* Remove more old nth calls

* Good ole rustfmt

* Add named len

Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
2022-04-09 14:55:02 +12:00
JT
5afd45414e
Revert "nu-cli/completions: cache layer for fetching (#5114)" (#5132)
This reverts commit e86c1b118e.
2022-04-08 21:48:27 +12:00
Michel Alexandre Salim
6ed033737d
Include license text in all crates (#5094)
* Include license text in all crates

Three crates already have license texts, so I'm keeping them, but
symlinking the `LICENSE` from the top level to the rest of the crate
directories. This works as long as `cargo publish` is done on a Unix-y
system and not Windows.

Also bump the copyright year to end in 2022.

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>

* Replace symlinks

Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-04-08 10:47:13 +02:00
Fernando Herrera
6b4cb8b0e0
short descriptions (#5130) 2022-04-08 07:57:39 +01:00
Herlon Aguiar
48fa25fd42
nu-cli/completions: removed default filter for command (#5126) 2022-04-07 18:45:04 -05:00
Herlon Aguiar
e86c1b118e
nu-cli/completions: cache layer for fetching (#5114) 2022-04-08 07:36:16 +12:00
Herlon Aguiar
5e177fe8e7
nu-cli/completions: fix file completions filtering (#5122) 2022-04-08 07:31:56 +12:00
JT
ef1934a7ee
Remove external name exceptions (#5115) 2022-04-07 14:01:31 +12:00
Herlon Aguiar
c3bed1352a
nu-cli/completions: prioritize non hidden folders (#5108) 2022-04-06 16:56:43 +01:00
Fernando Herrera
3ceb39c82c
use arc to avoid cloning entire engine for menus (#5104)
* use arc to avoid cloning entire engine for menus

* remove complete import path

* remove stack clone

* reference in completer
2022-04-06 13:25:02 +01:00
Herlon Aguiar
13869e7d52
nu-cli: refactor completions (#5102) 2022-04-06 19:58:55 +12:00
Fernando Herrera
fa6ed7a40b
allow record as text style (#5092) 2022-04-04 22:36:48 +01:00
sholderbach
80f21d37e0
Update reedline to mut Completer API 2022-04-04 23:35:31 +02:00
JT
abe028f930
Add raw strings, use raw strings for env (#5090) 2022-04-05 08:42:26 +12:00
Herlon Aguiar
ef1cf7e634
feature: Add some context to completions (#5078)
* send current line and position

* copy current line

* fix error

* deleted test completion
2022-04-05 06:31:40 +12:00
Fernando Herrera
608b6f3634
Generic menus (#5085)
* updated to reedline generic menus

* help menu with examples

* generic menus in the engine

* description menu template

* list of menus in config

* default value for menu

* menu from block

* generic menus examples

* change to reedline git path

* cargo fmt

* menu name typo

* remove commas from default file

* added error message
2022-04-04 15:54:48 +01:00
Reilly Wood
a86e6ce89b
Set LAST_EXIT_CODE on parse error (#5084) 2022-04-04 06:11:27 -05:00
JT
80c9888f82
Add command descriptions to completions (#5063) 2022-04-02 08:18:11 +13:00
Fernando Herrera
a088081695
update reedline (#5062) 2022-04-01 19:22:40 +01:00
JT
1d2d31580b
Allow strings for prompt env vars (#5052) 2022-04-01 12:00:50 +13:00
Stefan Holderbach
2193910579
Update reedline to new constructor API (#5051) 2022-04-01 11:16:28 +13:00
Stefan Holderbach
0986c61a5d
Lift line editor construction out of loop (#5041)
Enables the use of some features on reedline

- Keeping the line when clearing the screen with `Ctrl-L`
- Using the internal cut buffer between lines
- Submitting external commands via keybinding and keeping the line

Additional effect:

Keep the history around and do basic syncs (performance improvement
minimal as session changes have to be read and written)

Additional change:

Give the option to defer writing/rereading the history file to the
closing of the session ($config.sync_history_on_enter)
2022-03-31 23:25:48 +02:00
Darren Schroeder
05f7d7d38b
finish hooking up completion descriptions (#5047) 2022-03-31 11:13:16 -05:00