mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Merge pull request #4413 from jhowww/rm-move-help-strings-to-md-file
rm: move help strings to markdown file
This commit is contained in:
commit
257e6ea681
2 changed files with 27 additions and 17 deletions
22
src/uu/rm/rm.md
Normal file
22
src/uu/rm/rm.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# rm
|
||||||
|
|
||||||
|
```
|
||||||
|
rm [OPTION]... FILE...
|
||||||
|
```
|
||||||
|
|
||||||
|
Remove (unlink) the FILE(s)
|
||||||
|
|
||||||
|
## After Help
|
||||||
|
|
||||||
|
By default, rm does not remove directories. Use the --recursive (-r or -R)
|
||||||
|
option to remove each listed directory, too, along with all of its contents
|
||||||
|
|
||||||
|
To remove a file whose name starts with a '-', for example '-foo',
|
||||||
|
use one of these commands:
|
||||||
|
rm -- -foo
|
||||||
|
|
||||||
|
rm ./-foo
|
||||||
|
|
||||||
|
Note that if you use rm to remove a file, it might be possible to recover
|
||||||
|
some of its contents, given sufficient expertise and/or time. For greater
|
||||||
|
assurance that the contents are truly unrecoverable, consider using shred.
|
|
@ -15,7 +15,7 @@ use std::ops::BitOr;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{UResult, USimpleError, UUsageError};
|
use uucore::error::{UResult, USimpleError, UUsageError};
|
||||||
use uucore::{format_usage, prompt_yes, show_error};
|
use uucore::{format_usage, help_about, help_section, help_usage, prompt_yes, show_error};
|
||||||
use walkdir::{DirEntry, WalkDir};
|
use walkdir::{DirEntry, WalkDir};
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Clone, Copy)]
|
#[derive(Eq, PartialEq, Clone, Copy)]
|
||||||
|
@ -37,21 +37,9 @@ struct Options {
|
||||||
verbose: bool,
|
verbose: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ABOUT: &str = "Remove (unlink) the FILE(s)";
|
const ABOUT: &str = help_about!("rm.md");
|
||||||
const USAGE: &str = "{} [OPTION]... FILE...";
|
const USAGE: &str = help_usage!("rm.md");
|
||||||
const LONG_USAGE: &str = "\
|
const AFTER_HELP: &str = help_section!("after help", "rm.md");
|
||||||
By default, rm does not remove directories. Use the --recursive (-r or -R)
|
|
||||||
option to remove each listed directory, too, along with all of its contents
|
|
||||||
|
|
||||||
To remove a file whose name starts with a '-', for example '-foo',
|
|
||||||
use one of these commands:
|
|
||||||
rm -- -foo
|
|
||||||
|
|
||||||
rm ./-foo
|
|
||||||
|
|
||||||
Note that if you use rm to remove a file, it might be possible to recover
|
|
||||||
some of its contents, given sufficient expertise and/or time. For greater
|
|
||||||
assurance that the contents are truly unrecoverable, consider using shred.";
|
|
||||||
|
|
||||||
static OPT_DIR: &str = "dir";
|
static OPT_DIR: &str = "dir";
|
||||||
static OPT_INTERACTIVE: &str = "interactive";
|
static OPT_INTERACTIVE: &str = "interactive";
|
||||||
|
@ -69,7 +57,7 @@ static ARG_FILES: &str = "files";
|
||||||
|
|
||||||
#[uucore::main]
|
#[uucore::main]
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let matches = uu_app().after_help(LONG_USAGE).try_get_matches_from(args)?;
|
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?;
|
||||||
|
|
||||||
let files: Vec<String> = matches
|
let files: Vec<String> = matches
|
||||||
.get_many::<String>(ARG_FILES)
|
.get_many::<String>(ARG_FILES)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue