From 587536ddccee3d3c8cdae4f44c5b6d2fa93345b0 Mon Sep 17 00:00:00 2001 From: Leon Date: Sun, 20 Nov 2022 04:33:30 +1000 Subject: [PATCH] Edit `rm` help messages (#7165) * Edit `rm` help messages * Restore accidental missing changes --- crates/nu-command/src/filesystem/rm.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/crates/nu-command/src/filesystem/rm.rs b/crates/nu-command/src/filesystem/rm.rs index 87ad835cda..b775606bc4 100644 --- a/crates/nu-command/src/filesystem/rm.rs +++ b/crates/nu-command/src/filesystem/rm.rs @@ -36,7 +36,7 @@ impl Command for Rm { } fn usage(&self) -> &str { - "Remove file(s)." + "Remove files and directories." } fn search_terms(&self) -> Vec<&str> { @@ -53,21 +53,17 @@ impl Command for Rm { let sig = sig .switch( "trash", - "use the platform's recycle bin instead of permanently deleting", + "move to the platform's trash instead of permanently deleting", Some('t'), ) .switch( "permanent", - "don't use recycle bin, delete permanently", + "delete permanently, ignoring the 'always_trash' config option", Some('p'), ); sig.switch("recursive", "delete subdirectories recursively", Some('r')) .switch("force", "suppress error when no file", Some('f')) - .switch( - "verbose", - "make rm to be verbose, showing files been deleted", - Some('v'), - ) + .switch("verbose", "print names of deleted files", Some('v')) .switch("interactive", "ask user to confirm action", Some('i')) .rest( "rest", @@ -90,7 +86,7 @@ impl Command for Rm { fn examples(&self) -> Vec { let mut examples = vec![Example { description: - "Delete or move a file to the trash (depending on 'always_trash' config option)", + "Delete, or move a file to the trash (based on the 'always_trash' config option)", example: "rm file.txt", result: None, }]; @@ -101,21 +97,27 @@ impl Command for Rm { ))] examples.append(&mut vec![ Example { - description: "Move a file to the system trash", + description: "Move a file to the trash", example: "rm --trash file.txt", result: None, }, Example { - description: "Delete a file permanently", + description: + "Delete a file permanently, even if the 'always_trash' config option is true", example: "rm --permanent file.txt", result: None, }, ]); examples.push(Example { - description: "Delete a file, and suppress errors if no file is found", + description: "Delete a file, ignoring 'file not found' errors", example: "rm --force file.txt", result: None, }); + examples.push(Example { + description: "Delete all 0KB files in the current directory", + example: "ls | where size == 0KB && type == file | each { rm $in.name } | null", + result: None, + }); examples } }