From 68d68f04eddb8038cca320c8a0892ef282293db8 Mon Sep 17 00:00:00 2001 From: Chen Chi <114895836+ChenChiii@users.noreply.github.com> Date: Sun, 5 Mar 2023 16:36:01 -0800 Subject: [PATCH 1/2] ptx: move help strings to markdown file --- src/uu/ptx/ptx.md | 10 ++++++++++ src/uu/ptx/src/ptx.rs | 12 +++--------- 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 src/uu/ptx/ptx.md diff --git a/src/uu/ptx/ptx.md b/src/uu/ptx/ptx.md new file mode 100644 index 000000000..4bd2152fe --- /dev/null +++ b/src/uu/ptx/ptx.md @@ -0,0 +1,10 @@ +# ptx + +``` +ptx [OPTION]... [INPUT]... +ptx -G [OPTION]... [INPUT [OUTPUT]] +``` + +Output a permuted index, including context, of the words in the input files. +Mandatory arguments to long options are mandatory for short options too. +With no FILE, or when FILE is -, read standard input. Default is '-F /'. \ No newline at end of file diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 9716aaf30..4d411ed31 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -19,16 +19,10 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::num::ParseIntError; use uucore::display::Quotable; use uucore::error::{FromIo, UError, UResult}; -use uucore::format_usage; +use uucore::{format_usage, help_about, help_usage}; -const USAGE: &str = "\ - {} [OPTION]... [INPUT]... - {} -G [OPTION]... [INPUT [OUTPUT]]"; - -const ABOUT: &str = "\ - Output a permuted index, including context, of the words in the input files. \n\n\ - Mandatory arguments to long options are mandatory for short options too.\n\ - With no FILE, or when FILE is -, read standard input. Default is '-F /'."; +const USAGE: &str = help_usage!("ptx.md"); +const ABOUT: &str = help_about!("ptx.md"); const REGEX_CHARCLASS: &str = "^-]\\"; From d971f45ed9f50d1226ac1e9f017ede901df9fc64 Mon Sep 17 00:00:00 2001 From: Chen Chi <114895836+ChenChiii@users.noreply.github.com> Date: Sun, 5 Mar 2023 16:43:37 -0800 Subject: [PATCH 2/2] ptx: add description --- src/uu/ptx/ptx.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/ptx/ptx.md b/src/uu/ptx/ptx.md index 4bd2152fe..b8717776c 100644 --- a/src/uu/ptx/ptx.md +++ b/src/uu/ptx/ptx.md @@ -5,6 +5,7 @@ ptx [OPTION]... [INPUT]... ptx -G [OPTION]... [INPUT [OUTPUT]] ``` +Produce a permuted index of file contents Output a permuted index, including context, of the words in the input files. Mandatory arguments to long options are mandatory for short options too. With no FILE, or when FILE is -, read standard input. Default is '-F /'. \ No newline at end of file