diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index cd4d728d9a1..16b4ab2c490 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -12,15 +12,11 @@ use std::path::Path; use std::str::FromStr; use uucore::display::Quotable; use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; -use uucore::format_usage; +use uucore::{format_usage, help_about, help_section, help_usage}; -const ABOUT: &str = "Report or omit repeated lines."; -const USAGE: &str = "{} [OPTION]... [INPUT [OUTPUT]]..."; -const LONG_USAGE: &str = "\ - Filter adjacent matching lines from INPUT (or standard input),\n\ - writing to OUTPUT (or standard output).\n\n\ - Note: 'uniq' does not detect repeated lines unless they are adjacent.\n\ - You may want to sort the input first, or use 'sort -u' without 'uniq'."; +const ABOUT: &str = help_about!("uniq.md"); +const USAGE: &str = help_usage!("uniq.md"); +const AFTER_HELP: &str = help_section!("after help", "uniq.md"); pub mod options { pub static ALL_REPEATED: &str = "all-repeated"; @@ -247,7 +243,7 @@ fn opt_parsed(opt_name: &str, matches: &ArgMatches) -> UResult 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 = matches .get_many::(ARG_FILES) diff --git a/src/uu/uniq/uniq.md b/src/uu/uniq/uniq.md new file mode 100644 index 00000000000..dea57081b77 --- /dev/null +++ b/src/uu/uniq/uniq.md @@ -0,0 +1,15 @@ +# uniq + +``` +uniq [OPTION]... [INPUT [OUTPUT]]... +``` + +Report or omit repeated lines. + +## After help + +Filter adjacent matching lines from `INPUT` (or standard input), +writing to `OUTPUT` (or standard output). + +Note: `uniq` does not detect repeated lines unless they are adjacent. +You may want to sort the input first, or use `sort -u` without `uniq`.