mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
Merge pull request #4424 from jhowww/ln-move-help-strings-to-md-file
ln: move help strings to markdown file
This commit is contained in:
commit
2ea050c8a9
2 changed files with 28 additions and 19 deletions
21
src/uu/ln/ln.md
Normal file
21
src/uu/ln/ln.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# ln
|
||||
|
||||
```
|
||||
ln [OPTION]... [-T] TARGET LINK_NAME
|
||||
ln [OPTION]... TARGET
|
||||
ln [OPTION]... TARGET... DIRECTORY
|
||||
ln [OPTION]... -t DIRECTORY TARGET...
|
||||
```
|
||||
|
||||
Change file owner and group
|
||||
|
||||
## After Help
|
||||
|
||||
In the 1st form, create a link to TARGET with the name LINK_NAME.
|
||||
In the 2nd form, create a link to TARGET in the current directory.
|
||||
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.
|
||||
Create hard links by default, symbolic links with --symbolic.
|
||||
By default, each destination (name of new link) should not already exist.
|
||||
When creating hard links, each TARGET must exist. Symbolic links
|
||||
can hold arbitrary text; if later resolved, a relative link is
|
||||
interpreted in relation to its parent directory.
|
|
@ -11,7 +11,7 @@ use clap::{crate_version, Arg, ArgAction, Command};
|
|||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UError, UResult};
|
||||
use uucore::fs::{make_path_relative_to, paths_refer_to_same_file};
|
||||
use uucore::{format_usage, prompt_yes, show_error};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, prompt_yes, show_error};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::error::Error;
|
||||
|
@ -85,21 +85,9 @@ impl UError for LnError {
|
|||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = "Change file owner and group";
|
||||
const USAGE: &str = "\
|
||||
{} [OPTION]... [-T] TARGET LINK_NAME
|
||||
{} [OPTION]... TARGET
|
||||
{} [OPTION]... TARGET... DIRECTORY
|
||||
{} [OPTION]... -t DIRECTORY TARGET...";
|
||||
const LONG_USAGE: &str = "\
|
||||
In the 1st form, create a link to TARGET with the name LINK_NAME.\n\
|
||||
In the 2nd form, create a link to TARGET in the current directory.\n\
|
||||
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.\n\
|
||||
Create hard links by default, symbolic links with --symbolic.\n\
|
||||
By default, each destination (name of new link) should not already exist.\n\
|
||||
When creating hard links, each TARGET must exist. Symbolic links\n\
|
||||
can hold arbitrary text; if later resolved, a relative link is\n\
|
||||
interpreted in relation to its parent directory.";
|
||||
const ABOUT: &str = help_about!("ln.md");
|
||||
const USAGE: &str = help_usage!("ln.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "ln.md");
|
||||
|
||||
mod options {
|
||||
pub const FORCE: &str = "force";
|
||||
|
@ -119,13 +107,13 @@ static ARG_FILES: &str = "files";
|
|||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let long_usage = format!(
|
||||
let after_help = format!(
|
||||
"{}\n\n{}",
|
||||
LONG_USAGE,
|
||||
AFTER_HELP,
|
||||
backup_control::BACKUP_CONTROL_LONG_HELP
|
||||
);
|
||||
|
||||
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)?;
|
||||
|
||||
/* the list of files */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue