Commit Graph

234 Commits

Author SHA1 Message Date
goldfish
c422c6cc3d
Fix completion on $nu to show correct menus (#8919)
I'm still new to nushell and Rust, so please let me know if there are
any omissions and/or mistakes.

# Description

fixed #8863
`$nu` completion shows wrong completion menus at this time.
This PR fixes the problem to show the correct ones.

# User-Facing Changes

Users can use the correct menus on `$nu` completion like this
[recording](https://asciinema.org/a/KCwfpdAoMFsQODFBnb3NwmufC).

# Tests + Formatting

```
$ use toolkit.nu
$ toolkit check pr

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
```

# After Submitting

nothing
2023-04-26 09:15:27 -05:00
goldfish
45d33e70db
Change NU_LIB_DIRS not to depend on $nu.config-path (#8887) 2023-04-14 23:16:00 +03:00
Jelle Besseling
e6b196c141
Add $nu.current-exe variable (#8789)
# Description

Part solving #8752

Adds an extra variable to the `nu` table `current-exe` which is the path
to the running shell executable.

# User-Facing Changes

Adds a variable to the `nu` table.

# Tests + Formatting

Tests and formatting have been run. No new test added

# After Submitting

I could add documentation for this if wanted

Co-authored-by: Jelle Besseling <jelle@bigbridge.nl>
2023-04-07 13:51:09 -05:00
Jakub Žádník
1b677f167e
Remove old alias implementation (#8797) 2023-04-07 21:09:38 +03:00
JT
aded2c1937
Refactor to support multiple parse errors (#8765)
# Description

This is a pretty heavy refactor of the parser to support multiple parser
errors. It has a few issues we should address before landing:

- [x] In some cases, error quality has gotten worse `1 / "bob"` for
example
- [x] if/else isn't currently parsing correctly
- probably others

# User-Facing Changes

This may have error quality degradation as we adjust to the new error
reporting mechanism.

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-utils/standard_library/tests.nu` to run the
tests for the standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2023-04-07 12:35:45 +12:00
Antoine Stevan
4e78f3649b
FEATURE: add the startup time to $nu (#8353)
# Description
in https://github.com/nushell/nushell/issues/8311 and the discord
server, the idea of moving the default banner from the `rust` source to
the `nushell` standar library has emerged 😋

however, in order to do this, one need to have access to all the
variables used in the default banner => all of them are accessible
because known constants, except for the startup time of the shell, which
is not anywhere in the shell...

#### this PR adds exactly this, i.e. the new `startup_time` to the `$nu`
variable, which is computed to have the exact same value as the value
shown in the banner.

## the changes
in order to achieve this, i had to
- add `startup_time` as an `i64` to the `EngineState` => this is, to the
best of my knowledge, the easiest way to pass such an information around
down to where the banner startup time is computed and where the `$nu`
variable is evaluated
- add `startup-time` to the `$nu` variable and use the `EngineState`
getter for `startup_time` to show it as a `Value::Duration`
- pass `engine_state` as a `&mut`able argument from `main.rs` down to
`repl.rs` to allow the setter to change the value of `startup_time` =>
without this, the value would not change and would show `-1ns` as the
default value...
- the value of the startup time is computed in `evaluate_repl` in
`repl.rs`, only once at the beginning, and the same value is used in the
default banner 👌

# User-Facing Changes
one can now access to the same time as shown in the default banner with
```bash
$nu.startup-time
```

# Tests + Formatting
- 🟢 `cargo fmt --all`
- 🟢 `cargo clippy --workspace -- -D warnings -D
clippy::unwrap_used -A clippy::needless_collect`
- 🟢 `cargo test --workspace`

# After Submitting
```
$nothing
```
2023-03-09 14:18:58 -06:00
StevenDoesStuffs
7e949595bd
Add is-interactive and is-login to NuVariable and allow running scripts with -i (#8306)
Add two rows in `$nu`, `$nu.is-interactive` and `$nu.is-login`, which
are true when nu is run in interactive and login mode respectively.

The `-i` flag now behaves a bit more like that of bash's, where the any
provided command or file is run without REPL but in "interactive mode".
This should entail sourcing interactive-mode config files, but since we
are planning on overhauling the config system soon, I'm holding off on
that. For now, all `-i` does is set `$nu.is-interactive` to be true.

About testing, I can't seem to find where cli-args get tested, so I
haven't written any new tests for this. Also I don't think there are any
docs that need updating. However if I'm wrong please tell me.
2023-03-08 20:59:33 -06:00
Ryan Devenney
d34a2c353f
files and directory completions now use ascending ordering rather than Levenshtein. #8023 (#8085)
# Description

This change sorts completions for files and directories by the ascending
ordering method, related to issue:
[#8023](https://github.com/nushell/nushell/issues/8023)

Currently the Suggestions are being sorted twice, so it's now following
the convention from `completion/base.rs` to match on the
`self.get_sort_by()` result.

# User-Facing Changes

Previously the suggestions were being sorted by the Levenshtein method:
```
/home/rdevenney/projects/open_source/nushell| cd
src/                wix/                docs/               tests/
assets/             crates/             docker/             images/
target/             benches/            pkg_mgrs/           .git/
.cargo/             .github/
```

Now when you tab for autocompletions, they show up in ascending
alphabetical order as shown below (with hidden files/folders at the
end).
```
/home/rdevenney/projects/open_source/nushell| cd
assets/             benches/            crates/             docker/
docs/               images/             pkg_mgrs/           src/
target/             tests/              wix/                .cargo/
.git/               .github/
```

And when you've already typed a bit of the path:
```
/home/rdevenney/projects/open_source/nushell| cd crates/nu
crates/nu-cli/                   crates/nu-color-config/          crates/nu-command/
crates/nu-engine/                crates/nu-explore/               crates/nu-glob/
crates/nu-json/                  crates/nu-parser/                crates/nu-path/
crates/nu-plugin/                crates/nu-pretty-hex/            crates/nu-protocol/
crates/nu-system/                crates/nu-table/                 crates/nu-term-grid/
crates/nu-test-support/          crates/nu-utils/                 crates/nu_plugin_custom_values/
crates/nu_plugin_example/        crates/nu_plugin_formats/        crates/nu_plugin_gstat/
crates/nu_plugin_inc/            crates/nu_plugin_python/         crates/nu_plugin_query/
```

And another for when there are files and directories present:
```
/home/rdevenney/projects/open_source/nushell/crates/nu-cli/src| nvim                              02/16/2023 08:22:16 AM
commands.rs          completions/         config_files.rs      eval_file.rs
lib.rs               menus/               nu_highlight.rs      print.rs
prompt.rs            prompt_update.rs     reedline_config.rs   repl.rs
syntax_highlight.rs  util.rs              validation.rs
```

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

[*] `cargo fmt --all -- --check` to check standard code formatting
(`cargo fmt --all` applies these changes)
[*] `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
[*] `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2023-02-22 13:03:48 +00:00
Jakub Žádník
f3ee8b50e3
Revert #7779 (enables back subcommand completions) (#8102)
# Description

Reverts the PR #7779 which breaks subcommand completions. The issues
#7648 and #7754 thus still need fixing.

This reverts commit 8acced5.

# User-Facing Changes

Enables subcommand completions.

Unfortunately, also brings back the completion panic if alias is shorter
than the command name.

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2023-02-18 17:38:29 +00:00
Darren Schroeder
f4bf7316fe
fix completions PATH vs Path (#8003)
# Description

This PR attempts to fix the completions issue where, on Windows,
completions wouldn't get generated from items in your path environment
variable. This seemed to be down to `PATH` vs `Path`. So, I tried to add
a new function that we can use anywhere to avoid this problem.

# User-Facing Changes

_(List of all changes that impact the user experience here. This helps
us keep track of breaking changes.)_

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2023-02-08 20:53:46 -06:00
Stefan Holderbach
ab480856a5
Use variable names directly in the format strings (#7906)
# Description

Lint: `clippy::uninlined_format_args`

More readable in most situations.
(May be slightly confusing for modifier format strings
https://doc.rust-lang.org/std/fmt/index.html#formatting-parameters)

Alternative to #7865

# User-Facing Changes

None intended

# Tests + Formatting

(Ran `cargo +stable clippy --fix --workspace -- -A clippy::all -D
clippy::uninlined_format_args` to achieve this. Depends on Rust `1.67`)
2023-01-29 19:37:54 -06:00
JT
36ddbfdc85
Add 'number' command for enumeration (#7871)
# Description

This adds a `number` command that will enumerate the input, and add an
`index` and `item` record for each item. The `index` is the number of
the item in the input stream, and `item` is the original value of the
item.

```
> ls | number | get 14
╭───────┬────────────────────────────╮
│ index │ 14                         │
│       │ ╭──────────┬─────────────╮ │
│ item  │ │ name     │ crates      │ │
│       │ │ type     │ dir         │ │
│       │ │ size     │ 832 B       │ │
│       │ │ modified │ 2 weeks ago │ │
│       │ ╰──────────┴─────────────╯ │
╰───────┴────────────────────────────╯
```

# User-Facing Changes

This adds a `number` command.

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2023-01-28 06:45:57 +13:00
Xoffio
6a43e1a64d
Add test for fix of issue #7754 (#7756)
Fix already landed with #7779
2023-01-19 11:19:27 +01:00
Xoffio
8acced56b2
Fixes Issue 7648 which crashes nushell and happens when an alias name is shorter than the alias command and the alias command is an external command. (#7779) 2023-01-17 08:30:00 +02:00
WindSoilder
f609a4f26a
Auto-Completion: put ` tildes around filenames with parentheses (#7712)
# Description

Fixes: #7706

# User-Facing Changes


![img](https://user-images.githubusercontent.com/22256154/211286663-3d07a650-5e2d-406e-99f6-cff90dba352b.png)


# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
2023-01-10 20:41:54 +01:00
Darren Schroeder
db06edc5d3
add --mime-type(-m) to ls in the type column (#7616)
# Description

This PR adds the `mime-type` to the `type` column if you add the
`--mime-type(-m)` flag to `ls`.
<img width="853" alt="Screenshot 2022-12-27 at 11 43 20 AM"
src="https://user-images.githubusercontent.com/343840/209705499-27fe40fe-0356-4d9d-97f2-4b2dc52e0963.png">

<img width="781" alt="Screenshot 2022-12-27 at 11 45 53 AM"
src="https://user-images.githubusercontent.com/343840/209705509-4d677389-fd68-401e-a7af-3fc6052743b6.png">

# User-Facing Changes

If you specify the `-m` flag, you get the "guessed at" mime type. The
guess is based on the file name and uses this crate
https://docs.rs/mime_guess/latest/mime_guess/ for the guessing.

Part of issue #7612 and and #7524

There's some debate on if the `mime-type` should be added to the `type`
column or if there should be a separate `mime` column. I tend to lean on
the side of `type` since it's technically a type and it's only in that
column if you ask it to be there. Also, I'd prefer to reuse a column
rather than having a list of sprawling columns. Also, as @KodiCraft
suggested, there is precedence as with `ls -d` where the summed size is
in the size column.

I could go either way and if someone wants to create a `mime` column,
we'd probably accept it.

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2022-12-27 12:46:23 -06:00
Kian-Meng Ang
79000aa5e0
Fix typos by codespell (#7600)
# Description

Found via `codespell -S target -L
crate,ser,numer,falsy,ro,te,nd,bu,ndoes,statics,ons,fo,rouge,pard`

# User-Facing Changes

None.

# Tests + Formatting

None and done.

# After Submitting

None.
2022-12-26 02:31:26 -05:00
Jakub Žádník
757d7479af
Add "fall-through" signatures (#7527)
Fixes https://github.com/nushell/nushell/issues/4659
Fixes https://github.com/nushell/nushell/issues/5294
Fixes https://github.com/nushell/nushell/issues/6124
fix https://github.com/nushell/nushell/issues/5103
2022-12-22 00:33:26 +02:00
pwygab
b39d797c1f
Add quotes to hash file autocomplete (#7398)
# Description

Fixes #6741. Autocompleting a dir/file named something like foo#bar will
now complete to \`foo#bar\`
2022-12-08 21:37:10 +01:00
Daniel Buch Hansen
850ecf648a
Protocol: debug_assert!() Span to reflect a valid slice (#6806)
Also enforce this by #[non_exhaustive] span such that going forward we
cannot, in debug builds (1), construct invalid spans.

The motivation for this stems from #6431 where I've seen crashes due to
invalid slice indexing.

My hope is this will mitigate such senarios

1. https://github.com/nushell/nushell/pull/6431#issuecomment-1278147241

# Description

(description of your pull request here)

# Tests

Make sure you've done the following:

- [ ] Add tests that cover your changes, either in the command examples,
the crate/tests folder, or in the /tests folder.
- [ ] Try to think about corner cases and various ways how your changes
could break. Cover them with tests.
- [ ] If adding tests is not possible, please document in the PR body a
minimal example with steps on how to reproduce so one can verify your
change works.

Make sure you've run and fixed any issues with these commands:

- [x] `cargo fmt --all -- --check` to check standard code formatting
(`cargo fmt --all` applies these changes)
- [ ] `cargo clippy --workspace --features=extra -- -D warnings -D
clippy::unwrap_used -A clippy::needless_collect` to check that you're
using the standard code style
- [ ] `cargo test --workspace --features=extra` to check that all the
tests pass

# Documentation

- [ ] If your PR touches a user-facing nushell feature then make sure
that there is an entry in the documentation
(https://github.com/nushell/nushell.github.io) for the feature, and
update it if necessary.
2022-12-03 11:44:12 +02:00
Kangaxx-0
7b9ad9d2e5
Fix issue 6596 (#6603)
* Fix issue 6596

* add two unit tests

* fix pipe

* add cp test

* fix test on windows
2022-09-29 10:43:58 +02:00
Stefan Holderbach
f7647584a3
Clippy with the current stable toolchain (#6615)
Fix lints that are coming with rust 1.64

Passes with the earlier toolchain from `rust-toolchain.toml` as well.
2022-09-26 19:29:25 +02:00
JT
43905caa46
touchup some clippy warnings in tests (#6612) 2022-09-26 09:06:13 +13:00
Kangaxx-0
d9d14b38de
[Cleanup]Nu completion unit tests (#6601)
* clean up completion unit tests

* update
2022-09-22 21:50:16 +03:00
Darren Schroeder
71844755e5
add history session command (#6587) 2022-09-19 14:30:04 -05:00
Darren Schroeder
0b9dd87ca8
add history session id to $nu (#6585)
* add history session id to $nu

* get nushell to compile

* update test
2022-09-19 09:28:36 -05:00
JT
c52d45cb97
Move from source to source-env (#6277)
* start working on source-env

* WIP

* Get most tests working, still one to go

* Fix file-relative paths; Report parser error

* Fix merge conflicts; Restore source as deprecated

* Tests: Use source-env; Remove redundant tests

* Fmt

* Respect hidden env vars

* Fix file-relative eval for source-env

* Add file-relative eval to "overlay use"

* Use FILE_PWD only in source-env and "overlay use"

* Ignore new tests for now

This will be another issue

* Throw an error if setting FILE_PWD manually

* Fix source-related test failures

* Fix nu-check to respect FILE_PWD

* Fix corrupted spans in source-env shell errors

* Fix up some references to old source

* Remove deprecation message

* Re-introduce deleted tests

Co-authored-by: kubouch <kubouch@gmail.com>
2022-09-01 08:32:56 +12:00
pwygab
e45b169cba
default to file completion after first command, add command option for completions (#6257)
* remove unnecessary FlatShape

* add test
2022-08-24 22:46:00 +03:00
Herlon Aguiar
530e250573
nu-cli: merge completions tests into one file (#6389)
This PR merges all the completions tests into one file.

The reason for them to be separated was organization, so we wouldn't need to scroll a huge file.
But that came with another issue, because rust generates a new binary for each completion test file and each completion test depends on Nu looks like all the dataframes were coming into each test file as well (as pointed by @rgwood
2022-08-23 16:24:24 +02:00
Herlon Aguiar
646aace05b
feat: external completions for commands/flags (#6295)
* wip

* wip

* cleanup

* error message

* cleanup

* cleanup

* fix clippy

* add test

* fix span

* cleanup

* cleanup

* cleanup

* fixed completion

* push char

* wip

* small fixes

* fix remove last span

* fmt

* cleanup

* fixes + more tests

* fix test

* only complete for commands

* also complete flags

* change decl_id to block_id

* use nu completion first

* fix test

* ignore test

* update config section
2022-08-22 21:38:51 +03:00
Jack Clayton
9ced5915ff
Fix short-flag completion (#6067) 2022-07-17 07:46:40 -05:00
Jakub Žádník
26f31da711
Split merging of parser delta and stack environment (#6005)
* Remove comment

* Split delta and environment merging

* Move table mode to a more logical place

* Cleanup

* Merge environment after reading default_env.nu

* Fmt
2022-07-14 17:09:27 +03:00
默可思
221f36ca65
Add --directory (-D) flag to ls, list the directory itself instead of its contents (#5970)
* Avoid extending the directory without globs in `nu_engine::glob_from`

* avoid joining a `*` to the directory without globs

* remove checks on directory permission and whether it is empty

The previous implemention of `nu_engine::glob_from` will extend the
given directory even if it containes no glob pattern. This commit
overcomes lack of consistency with the function `nu_glob::glob`.

* Add flag -D to ls, to list the directory itself instead of its contents

* add --directory (-d) flag to ls

* correct the difference between the given path and the cwd

* set default path to `.` instead of `./*` when --directory (-d) flag is true

* add comments

* add an example

* add tests

* fmt
2022-07-08 14:15:34 -05:00
JT
575ddbd4ef
Clippy and remove unused is_binary (#5879) 2022-06-26 08:20:28 +12:00
Kangaxx-0
08aa248c42
Add more tests for completion (#5826)
* Add more tests for completion

* Fix windows

* Cleanup
2022-06-18 19:42:00 -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
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
sec65
3c421c5726
Added loginshell config file #4620 (#5714)
* Added loginshell config file #4620

* added sample login.nu

* added environment variable loginshell-path
2022-06-06 06:52:37 -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
Herlon Aguiar
f6ee21f76b
nu-cli/completions: add filtering tests for variables completions (#5653) 2022-05-26 23:38:03 +02:00
Herlon Aguiar
c047fd4778
nu-cli/completions: add custom completion test (#5543) 2022-05-14 15:09:41 -05:00
Herlon Aguiar
1d64863585
nu-cli/completions: add variable completions test + refactor tests (#5504)
* refactor tests

* removed old test file
2022-05-10 15:17:07 -05:00
Herlon Aguiar
8218f72eea
nu-cli/completions: added tests for dotnu completions (#5460) 2022-05-10 13:18:18 -05:00
JT
3a35bf7d4e
Add hooks to cli/repl (#5479)
* Add hooks to cli/repl

* Clippy

* Clippy
2022-05-09 07:28:39 +12:00
Herlon Aguiar
ca75cd7c0a
nu-cli/completions: add tests for flag completions (#5468) 2022-05-07 15:19:48 -05:00
Darren Schroeder
2659ea3dbd
Revert "nu-cli/completions: better fix for files with special characters (#5254)" (#5372)
This reverts commit 3cf3329e49.
2022-04-29 13:11:41 -05:00
Herlon Aguiar
3cf3329e49
nu-cli/completions: better fix for files with special characters (#5254)
* nu-cli/completions: fix paths with special chars

* add backticks

* fix replace

* added single quotes to check list

* check escape using fold

* fix clippy errors

* fix comment line

* fix conflicts

* change to vec

* skip sort checking

* removed invalid windows path

* remove comment

* added tests for escape function

* fix fn import

* fix fn import error

* test windows issue fix

* fix windows backslash path in the tests

* show expected path on error

* skip test for windows
2022-04-28 08:36:32 -05:00
Herlon Aguiar
5ff2ae628b
nu-cli: directory syntax shape + completions (#5299) 2022-04-22 15:18:51 -05:00
JT
ded9d1cedb
Some cleanups for clippy (#5266) 2022-04-21 12:08:12 +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