Edit rm help messages (#7165)

* Edit `rm` help messages

* Restore accidental missing changes
This commit is contained in:
Leon 2022-11-20 04:33:30 +10:00 committed by GitHub
parent ced5e1065f
commit 587536ddcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<Example> {
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
}
}