mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
Use help_about! & adapt help files for its usage
This commit is contained in:
parent
2c027a9312
commit
dcc7c4ed7b
16 changed files with 32 additions and 47 deletions
|
@ -1,12 +1,9 @@
|
||||||
# base32
|
# base32
|
||||||
|
|
||||||
## Usage
|
|
||||||
```
|
```
|
||||||
base32 [OPTION]... [FILE]
|
base32 [OPTION]... [FILE]
|
||||||
```
|
```
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
encode/decode data and print to standard output
|
encode/decode data and print to standard output
|
||||||
With no FILE, or when FILE is -, read standard input.
|
With no FILE, or when FILE is -, read standard input.
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
use std::io::{stdin, Read};
|
use std::io::{stdin, Read};
|
||||||
|
|
||||||
use clap::Command;
|
use clap::Command;
|
||||||
use uucore::{encoding::Format, error::UResult, help_section, help_usage};
|
use uucore::{encoding::Format, error::UResult, help_about, help_usage};
|
||||||
|
|
||||||
pub mod base_common;
|
pub mod base_common;
|
||||||
|
|
||||||
const ABOUT: &str = help_section!("about", "base32.md");
|
const ABOUT: &str = help_about!("base32.md");
|
||||||
const USAGE: &str = help_usage!("base32.md");
|
const USAGE: &str = help_usage!("base32.md");
|
||||||
|
|
||||||
#[uucore::main]
|
#[uucore::main]
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
# base64
|
# base64
|
||||||
|
|
||||||
## Usage
|
|
||||||
```
|
```
|
||||||
base64 [OPTION]... [FILE]
|
base64 [OPTION]... [FILE]
|
||||||
```
|
```
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
encode/decode data and print to standard output
|
encode/decode data and print to standard output
|
||||||
With no FILE, or when FILE is -, read standard input.
|
With no FILE, or when FILE is -, read standard input.
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
use uu_base32::base_common;
|
use uu_base32::base_common;
|
||||||
pub use uu_base32::uu_app;
|
pub use uu_base32::uu_app;
|
||||||
|
|
||||||
use uucore::{encoding::Format, error::UResult, help_section, help_usage};
|
use uucore::{encoding::Format, error::UResult, help_about, help_usage};
|
||||||
|
|
||||||
use std::io::{stdin, Read};
|
use std::io::{stdin, Read};
|
||||||
|
|
||||||
const ABOUT: &str = help_section!("about", "base64.md");
|
const ABOUT: &str = help_about!("base64.md");
|
||||||
const USAGE: &str = help_usage!("base64.md");
|
const USAGE: &str = help_usage!("base64.md");
|
||||||
|
|
||||||
#[uucore::main]
|
#[uucore::main]
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
# cat
|
# cat
|
||||||
|
|
||||||
## Usage
|
|
||||||
```
|
```
|
||||||
cat [OPTION]... [FILE]...
|
cat [OPTION]... [FILE]...
|
||||||
```
|
```
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
Concatenate FILE(s), or standard input, to standard output
|
Concatenate FILE(s), or standard input, to standard output
|
||||||
With no FILE, or when FILE is -, read standard input.
|
With no FILE, or when FILE is -, read standard input.
|
||||||
|
|
|
@ -33,10 +33,10 @@ use std::net::Shutdown;
|
||||||
use std::os::unix::fs::FileTypeExt;
|
use std::os::unix::fs::FileTypeExt;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::net::UnixStream;
|
use std::os::unix::net::UnixStream;
|
||||||
use uucore::{format_usage, help_section, help_usage};
|
use uucore::{format_usage, help_about, help_usage};
|
||||||
|
|
||||||
const USAGE: &str = help_usage!("cat.md");
|
const USAGE: &str = help_usage!("cat.md");
|
||||||
const ABOUT: &str = help_section!("about", "cat.md");
|
const ABOUT: &str = help_about!("cat.md");
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
enum CatError {
|
enum CatError {
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
# cp
|
# cp
|
||||||
|
|
||||||
## Usage
|
|
||||||
```
|
```
|
||||||
cp [OPTION]... [-T] SOURCE DEST
|
cp [OPTION]... [-T] SOURCE DEST
|
||||||
cp [OPTION]... SOURCE... DIRECTORY
|
cp [OPTION]... SOURCE... DIRECTORY
|
||||||
cp [OPTION]... -t DIRECTORY SOURCE...
|
cp [OPTION]... -t DIRECTORY SOURCE...
|
||||||
```
|
```
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
|
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
|
||||||
|
|
|
@ -40,7 +40,7 @@ use uucore::error::{set_exit_code, UClapError, UError, UResult, UUsageError};
|
||||||
use uucore::fs::{
|
use uucore::fs::{
|
||||||
canonicalize, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode,
|
canonicalize, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode,
|
||||||
};
|
};
|
||||||
use uucore::{crash, format_usage, help_section, help_usage, prompt_yes, show_error, show_warning};
|
use uucore::{crash, format_usage, help_about, help_usage, prompt_yes, show_error, show_warning};
|
||||||
|
|
||||||
use crate::copydir::copy_directory;
|
use crate::copydir::copy_directory;
|
||||||
|
|
||||||
|
@ -228,11 +228,11 @@ pub struct Options {
|
||||||
progress_bar: bool,
|
progress_bar: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ABOUT: &str = help_section!("about", "cp.md");
|
const ABOUT: &str = help_about!("cp.md");
|
||||||
static EXIT_ERR: i32 = 1;
|
|
||||||
|
|
||||||
const USAGE: &str = help_usage!("cp.md");
|
const USAGE: &str = help_usage!("cp.md");
|
||||||
|
|
||||||
|
static EXIT_ERR: i32 = 1;
|
||||||
|
|
||||||
// Argument constants
|
// Argument constants
|
||||||
mod options {
|
mod options {
|
||||||
pub const ARCHIVE: &str = "archive";
|
pub const ARCHIVE: &str = "archive";
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<!-- spell-checker:ignore convs iseek oseek -->
|
<!-- spell-checker:ignore convs iseek oseek -->
|
||||||
# dd
|
# dd
|
||||||
|
|
||||||
## About
|
```
|
||||||
|
dd [OPERAND]...
|
||||||
|
dd OPTION
|
||||||
|
```
|
||||||
|
|
||||||
Copy, and optionally convert, a file system resource
|
Copy, and optionally convert, a file system resource
|
||||||
|
|
||||||
## After Help
|
## After Help
|
||||||
|
|
|
@ -39,11 +39,11 @@ use clap::{crate_version, Arg, Command};
|
||||||
use gcd::Gcd;
|
use gcd::Gcd;
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{FromIo, UResult};
|
use uucore::error::{FromIo, UResult};
|
||||||
use uucore::help_section;
|
use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
||||||
use uucore::show_error;
|
|
||||||
|
|
||||||
const ABOUT: &str = help_section!("about", "dd.md");
|
const ABOUT: &str = help_about!("dd.md");
|
||||||
const AFTER_HELP: &str = help_section!("after help", "dd.md");
|
const AFTER_HELP: &str = help_section!("after help", "dd.md");
|
||||||
|
const USAGE: &str = help_usage!("dd.md");
|
||||||
const BUF_INIT_BYTE: u8 = 0xDD;
|
const BUF_INIT_BYTE: u8 = 0xDD;
|
||||||
|
|
||||||
/// Final settings after parsing
|
/// Final settings after parsing
|
||||||
|
@ -832,6 +832,7 @@ pub fn uu_app() -> Command {
|
||||||
Command::new(uucore::util_name())
|
Command::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
|
.override_usage(format_usage(USAGE))
|
||||||
.after_help(AFTER_HELP)
|
.after_help(AFTER_HELP)
|
||||||
.infer_long_args(true)
|
.infer_long_args(true)
|
||||||
.arg(Arg::new(options::OPERANDS).num_args(1..))
|
.arg(Arg::new(options::OPERANDS).num_args(1..))
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
# expr
|
# expr
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
Print the value of `EXPRESSION` to standard output
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
```
|
```
|
||||||
expr [EXPRESSION]
|
expr [EXPRESSION]
|
||||||
expr [OPTIONS]
|
expr [OPTIONS]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Print the value of `EXPRESSION` to standard output
|
||||||
|
|
||||||
## After help
|
## After help
|
||||||
|
|
||||||
Print the value of `EXPRESSION` to standard output. A blank line below
|
Print the value of `EXPRESSION` to standard output. A blank line below
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
use clap::{crate_version, Arg, ArgAction, Command};
|
use clap::{crate_version, Arg, ArgAction, Command};
|
||||||
use uucore::{
|
use uucore::{
|
||||||
error::{UResult, USimpleError},
|
error::{UResult, USimpleError},
|
||||||
format_usage, help_section, help_usage,
|
format_usage, help_about, help_section, help_usage,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod syntax_tree;
|
mod syntax_tree;
|
||||||
|
@ -23,7 +23,7 @@ mod options {
|
||||||
pub fn uu_app() -> Command {
|
pub fn uu_app() -> Command {
|
||||||
Command::new(uucore::util_name())
|
Command::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about(help_section!("about", "expr.md"))
|
.about(help_about!("expr.md"))
|
||||||
.override_usage(format_usage(help_usage!("expr.md")))
|
.override_usage(format_usage(help_usage!("expr.md")))
|
||||||
.after_help(help_section!("after help", "expr.md"))
|
.after_help(help_section!("after help", "expr.md"))
|
||||||
.infer_long_args(true)
|
.infer_long_args(true)
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
<!-- spell-checker:ignore N'th M'th -->
|
<!-- spell-checker:ignore N'th M'th -->
|
||||||
# numfmt
|
# numfmt
|
||||||
|
|
||||||
## Usage
|
|
||||||
```
|
```
|
||||||
numfmt [OPTION]... [NUMBER]...
|
numfmt [OPTION]... [NUMBER]...
|
||||||
```
|
```
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
Convert numbers from/to human-readable strings
|
Convert numbers from/to human-readable strings
|
||||||
|
|
||||||
## After Help
|
## After Help
|
||||||
|
|
|
@ -14,16 +14,15 @@ use std::io::{BufRead, Write};
|
||||||
use units::{IEC_BASES, SI_BASES};
|
use units::{IEC_BASES, SI_BASES};
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::UResult;
|
use uucore::error::UResult;
|
||||||
use uucore::format_usage;
|
|
||||||
use uucore::ranges::Range;
|
use uucore::ranges::Range;
|
||||||
use uucore::{help_section, help_usage};
|
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||||
|
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
pub mod format;
|
pub mod format;
|
||||||
pub mod options;
|
pub mod options;
|
||||||
mod units;
|
mod units;
|
||||||
|
|
||||||
const ABOUT: &str = help_section!("about", "numfmt.md");
|
const ABOUT: &str = help_about!("numfmt.md");
|
||||||
const AFTER_HELP: &str = help_section!("after help", "numfmt.md");
|
const AFTER_HELP: &str = help_section!("after help", "numfmt.md");
|
||||||
const USAGE: &str = help_usage!("numfmt.md");
|
const USAGE: &str = help_usage!("numfmt.md");
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,9 @@ use uucore::fsext::{
|
||||||
pretty_filetype, pretty_fstype, pretty_time, read_fs_list, statfs, BirthTime, FsMeta,
|
pretty_filetype, pretty_fstype, pretty_time, read_fs_list, statfs, BirthTime, FsMeta,
|
||||||
};
|
};
|
||||||
use uucore::libc::mode_t;
|
use uucore::libc::mode_t;
|
||||||
use uucore::{entries, format_usage, help_section, help_usage, show_error, show_warning};
|
use uucore::{
|
||||||
|
entries, format_usage, help_about, help_section, help_usage, show_error, show_warning,
|
||||||
|
};
|
||||||
|
|
||||||
use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
|
use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -24,7 +26,7 @@ use std::os::unix::fs::{FileTypeExt, MetadataExt};
|
||||||
use std::os::unix::prelude::OsStrExt;
|
use std::os::unix::prelude::OsStrExt;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
const ABOUT: &str = help_section!("about", "stat.md");
|
const ABOUT: &str = help_about!("stat.md");
|
||||||
const USAGE: &str = help_usage!("stat.md");
|
const USAGE: &str = help_usage!("stat.md");
|
||||||
const LONG_USAGE: &str = help_section!("long usage", "stat.md");
|
const LONG_USAGE: &str = help_section!("long usage", "stat.md");
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
# stat
|
# stat
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
Display file or file system status.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
```
|
```
|
||||||
stat [OPTION]... FILE...
|
stat [OPTION]... FILE...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Display file or file system status.
|
||||||
|
|
||||||
## Long Usage
|
## Long Usage
|
||||||
|
|
||||||
The valid format sequences for files (without `--file-system`):
|
The valid format sequences for files (without `--file-system`):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue