From 4c308b7f2fae3be40d91a4255c2f52590fd0ce0b Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Mon, 6 Feb 2023 11:00:44 +0100 Subject: [PATCH] Fix `def-env` docs according to docs#761 (#7972) See nushell/nushell.github.io#761 # User-Facing Changes Docs reflect up-to-date reality Co-authored-by: Canop --- .../nu-command/src/core_commands/def_env.rs | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/crates/nu-command/src/core_commands/def_env.rs b/crates/nu-command/src/core_commands/def_env.rs index 364742a041..803e68d5bb 100644 --- a/crates/nu-command/src/core_commands/def_env.rs +++ b/crates/nu-command/src/core_commands/def_env.rs @@ -28,32 +28,7 @@ impl Command for DefEnv { fn extra_usage(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html - -=== EXTRA NOTE === -All blocks are scoped, including variable definition and environment variable changes. - -Because of this, the following doesn't work: - -def-env cd_with_fallback [arg = ""] { - let fall_back_path = "/tmp" - if $arg != "" { - cd $arg - } else { - cd $fall_back_path - } -} - -Instead, you have to use cd in the top level scope: - -def-env cd_with_fallback [arg = ""] { - let fall_back_path = "/tmp" - let path = if $arg != "" { - $arg - } else { - $fall_back_path - } - cd $path -}"# +"# } fn is_parser_keyword(&self) -> bool {