diff --git a/crates/nu-command/src/platform/clear.rs b/crates/nu-command/src/platform/clear.rs index 30c6cc69a5..b47db161c6 100644 --- a/crates/nu-command/src/platform/clear.rs +++ b/crates/nu-command/src/platform/clear.rs @@ -19,14 +19,18 @@ impl Command for Clear { "Clear the terminal." } + fn extra_description(&self) -> &str { + "By default clears the current screen and the off-screen scrollback buffer." + } + fn signature(&self) -> Signature { Signature::build("clear") .category(Category::Platform) .input_output_types(vec![(Type::Nothing, Type::Nothing)]) .switch( - "all", - "Clear the terminal and its scroll-back history", - Some('a'), + "keep-scrollback", + "Do not clear the scrollback history", + Some('k'), ) } @@ -37,9 +41,9 @@ impl Command for Clear { call: &Call, _input: PipelineData, ) -> Result { - let clear_type: ClearType = match call.has_flag(engine_state, stack, "all")? { - true => ClearType::Purge, - _ => ClearType::All, + let clear_type: ClearType = match call.has_flag(engine_state, stack, "keep-scrollback")? { + true => ClearType::All, + _ => ClearType::Purge, }; std::io::stdout() .queue(ClearCommand(clear_type))? @@ -57,8 +61,8 @@ impl Command for Clear { result: None, }, Example { - description: "Clear the terminal and its scroll-back history", - example: "clear --all", + description: "Clear the terminal but not its scrollback history", + example: "clear --keep-scrollback", result: None, }, ]