Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit rm help messages #7165

Merged
merged 2 commits into from Nov 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 14 additions & 12 deletions crates/nu-command/src/filesystem/rm.rs
Expand Up @@ -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> {
Expand All @@ -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",
Expand All @@ -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,
}];
Expand All @@ -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
}
}
Expand Down