From ac39a169a12588cc4b0ea7e24b02f8826a970e7a Mon Sep 17 00:00:00 2001 From: Koki Ueha Date: Sat, 25 Feb 2023 10:27:03 +0000 Subject: [PATCH] df: move help strings to markdown file --- src/uu/df/df.md | 18 ++++++++++++++++++ src/uu/df/src/df.rs | 17 +++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 src/uu/df/df.md diff --git a/src/uu/df/df.md b/src/uu/df/df.md new file mode 100644 index 000000000..1a192f8fd --- /dev/null +++ b/src/uu/df/df.md @@ -0,0 +1,18 @@ +# df + +``` +df [OPTION]... [FILE]... +``` + +Show information about the file system on which each FILE resides, +or all file systems by default. + +## After Help + +Display values are in units of the first available SIZE from --block-size, +and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. +Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set). + +SIZE is an integer and optional unit (example: 10M is 10*1024*1024). +Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers +of 1000). diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index c501b0bab..685ebe58a 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -19,7 +19,7 @@ use uucore::error::FromIo; use uucore::error::{UError, UResult, USimpleError}; use uucore::fsext::{read_fs_list, MountInfo}; use uucore::parse_size::ParseSizeError; -use uucore::{format_usage, show}; +use uucore::{format_usage, help_about, help_section, help_usage, show}; use clap::{crate_version, parser::ValueSource, Arg, ArgAction, ArgMatches, Command}; @@ -33,16 +33,9 @@ use crate::columns::{Column, ColumnError}; use crate::filesystem::Filesystem; use crate::table::Table; -static ABOUT: &str = "Show information about the file system on which each FILE resides,\n\ - or all file systems by default."; -const USAGE: &str = "{} [OPTION]... [FILE]..."; -const LONG_HELP: &str = "Display values are in units of the first available SIZE from --block-size, -and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. -Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set). - -SIZE is an integer and optional unit (example: 10M is 10*1024*1024). -Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers -of 1000)."; +const ABOUT: &str = help_about!("df.md"); +const USAGE: &str = help_usage!("df.md"); +const AFTER_HELP: &str = help_section!("after help", "df.md"); static OPT_HELP: &str = "help"; static OPT_ALL: &str = "all"; @@ -487,7 +480,7 @@ pub fn uu_app() -> Command { .version(crate_version!()) .about(ABOUT) .override_usage(format_usage(USAGE)) - .after_help(LONG_HELP) + .after_help(AFTER_HELP) .infer_long_args(true) .disable_help_flag(true) .arg(