From 818171cc2c004d0c355a105c8ab6575194a49f7b Mon Sep 17 00:00:00 2001 From: Pirmin Kalberer Date: Thu, 23 Apr 2020 00:53:40 +0200 Subject: [PATCH] Make default completion mode OS dependent (#1636) --- crates/nu-cli/src/cli.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/nu-cli/src/cli.rs b/crates/nu-cli/src/cli.rs index 2205b296a..7f917a528 100644 --- a/crates/nu-cli/src/cli.rs +++ b/crates/nu-cli/src/cli.rs @@ -469,6 +469,11 @@ pub async fn run_pipeline_standalone( /// The entry point for the CLI. Will register all known internal commands, load experimental commands, load plugins, then prepare the prompt and line reader for input. pub async fn cli() -> Result<(), Box> { + #[cfg(windows)] + const DEFAULT_COMPLETION_MODE: CompletionType = CompletionType::Circular; + #[cfg(not(windows))] + const DEFAULT_COMPLETION_MODE: CompletionType = CompletionType::List; + let mut syncer = crate::env::environment_syncer::EnvironmentSyncer::new(); let mut context = create_default_context(&mut syncer)?; @@ -555,9 +560,9 @@ pub async fn cli() -> Result<(), Box> { .map(|s| match s.value.expect_string() { "list" => CompletionType::List, "circular" => CompletionType::Circular, - _ => CompletionType::Circular, + _ => DEFAULT_COMPLETION_MODE, }) - .unwrap_or(CompletionType::Circular); + .unwrap_or(DEFAULT_COMPLETION_MODE); rl.set_completion_type(completion_mode);