mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
shuf: correct execution phrase for --help
This commit is contained in:
parent
4f7f4445cb
commit
477b40f1e5
1 changed files with 6 additions and 10 deletions
|
@ -14,7 +14,7 @@ use std::fs::File;
|
||||||
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
|
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{FromIo, UResult, USimpleError};
|
use uucore::error::{FromIo, UResult, USimpleError};
|
||||||
use uucore::InvalidEncodingHandling;
|
use uucore::{execution_phrase, InvalidEncodingHandling};
|
||||||
|
|
||||||
mod rand_read_adapter;
|
mod rand_read_adapter;
|
||||||
|
|
||||||
|
@ -27,13 +27,8 @@ enum Mode {
|
||||||
static NAME: &str = "shuf";
|
static NAME: &str = "shuf";
|
||||||
static USAGE: &str = r#"shuf [OPTION]... [FILE]
|
static USAGE: &str = r#"shuf [OPTION]... [FILE]
|
||||||
or: shuf -e [OPTION]... [ARG]...
|
or: shuf -e [OPTION]... [ARG]...
|
||||||
or: shuf -i LO-HI [OPTION]...
|
or: shuf -i LO-HI [OPTION]..."#;
|
||||||
Write a random permutation of the input lines to standard output.
|
|
||||||
|
|
||||||
With no FILE, or when FILE is -, read standard input.
|
|
||||||
"#;
|
|
||||||
static ABOUT: &str = "Shuffle the input by outputting a random permutation of input lines. Each output permutation is equally likely.";
|
static ABOUT: &str = "Shuffle the input by outputting a random permutation of input lines. Each output permutation is equally likely.";
|
||||||
static TEMPLATE: &str = "Usage: {usage}\nMandatory arguments to long options are mandatory for short options too.\n{options}";
|
|
||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
head_count: usize,
|
head_count: usize,
|
||||||
|
@ -60,7 +55,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||||
.accept_any();
|
.accept_any();
|
||||||
|
|
||||||
let matches = uu_app().get_matches_from(args);
|
let matches = uu_app()
|
||||||
|
.override_usage(&USAGE.replace(NAME, execution_phrase())[..])
|
||||||
|
.get_matches_from(args);
|
||||||
|
|
||||||
let mode = if let Some(args) = matches.values_of(options::ECHO) {
|
let mode = if let Some(args) = matches.values_of(options::ECHO) {
|
||||||
Mode::Echo(args.map(String::from).collect())
|
Mode::Echo(args.map(String::from).collect())
|
||||||
|
@ -125,7 +122,6 @@ pub fn uu_app<'a>() -> App<'a> {
|
||||||
.name(NAME)
|
.name(NAME)
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.help_template(TEMPLATE)
|
|
||||||
.override_usage(USAGE)
|
.override_usage(USAGE)
|
||||||
.setting(AppSettings::InferLongArgs)
|
.setting(AppSettings::InferLongArgs)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue