Use list completions and better expansion

This commit is contained in:
JT 2021-10-05 10:37:32 +13:00
parent 58b0e571d3
commit 7c2bf68d45
3 changed files with 16 additions and 16 deletions

26
Cargo.lock generated
View file

@ -399,9 +399,9 @@ dependencies = [
[[package]]
name = "miette"
version = "3.0.0"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b98aebb9d23c72cb22c089834ea59be059c6f462e844fd9fd18dd0168ad149c"
checksum = "4786c5b04c6f73e96d88444e7f37e241d99479ea5dd88a4887363ab2e03b4e53"
dependencies = [
"atty",
"backtrace",
@ -418,9 +418,9 @@ dependencies = [
[[package]]
name = "miette-derive"
version = "3.0.0"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9a7cd3347eb52480d4ba59d71ce2b48b8b128034e17068c7e2ff3766c2e87a3"
checksum = "0ee63a981bc9cde5f26665ffd756b624963bf0b5956e0df51e52ef8f6b5466d6"
dependencies = [
"proc-macro2",
"quote",
@ -804,7 +804,7 @@ dependencies = [
[[package]]
name = "reedline"
version = "0.2.0"
source = "git+https://github.com/jntrnr/reedline?branch=main#93c2146fcf4257c40426bc2f0c6903d4115caaf1"
source = "git+https://github.com/jntrnr/reedline?branch=main#88bded3417e7f6c1242b444f403448de583357f0"
dependencies = [
"chrono",
"crossterm",
@ -936,9 +936,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.6.1"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
[[package]]
name = "smawk"
@ -948,9 +948,9 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
[[package]]
name = "supports-color"
version = "1.1.1"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f5b0f9e689dd52e27228469dd68b7416b60d75b7571ae9060a5f4c50048fee"
checksum = "4872ced36b91d47bae8a214a683fe54e7078875b399dfa251df346c9b547d1f9"
dependencies = [
"atty",
"is_ci",
@ -967,18 +967,18 @@ dependencies = [
[[package]]
name = "supports-unicode"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5fa283a620b255940913bd962cda2e6320e3799041f96ac0d7191ff2b4622f"
checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2"
dependencies = [
"atty",
]
[[package]]
name = "syn"
version = "1.0.77"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5239bc68e0fef57495900cfea4e8dc75596d9a319d7e16b1e0a440d24e6fe0a0"
checksum = "a4eac2e6c19f5c3abc0c229bea31ff0b9b091c7b14990e8924b92902a303a0c0"
dependencies = [
"proc-macro2",
"quote",

View file

@ -28,7 +28,7 @@ impl Command for Cd {
let path = match path {
Some(path) => {
let path = nu_path::expand_tilde(path);
let path = nu_path::expand_path(path);
path.to_string_lossy().to_string()
}
None => {

View file

@ -66,7 +66,7 @@ fn main() -> Result<()> {
Ok(())
} else {
use reedline::{DefaultCompletionActionHandler, FileBackedHistory, Reedline, Signal};
use reedline::{FileBackedHistory, ListCompletionHandler, Reedline, Signal};
let completer = NuCompleter::new(engine_state.clone());
let mut entry_num = 0;
@ -81,7 +81,7 @@ fn main() -> Result<()> {
engine_state: engine_state.clone(),
}))
.with_completion_action_handler(Box::new(
DefaultCompletionActionHandler::default().with_completer(Box::new(completer)),
ListCompletionHandler::default().with_completer(Box::new(completer)),
))
.with_validator(Box::new(NuValidator {
engine_state: engine_state.clone(),