Merge pull request #4434 from papparapa/df-move-help-strings-to-md-file

df: move help strings to markdown file
This commit is contained in:
Terts Diepraam 2023-02-25 13:13:39 +01:00 committed by GitHub
commit 542518c026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 12 deletions

18
src/uu/df/df.md Normal file
View file

@ -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).

View file

@ -19,7 +19,7 @@ use uucore::error::FromIo;
use uucore::error::{UError, UResult, USimpleError}; use uucore::error::{UError, UResult, USimpleError};
use uucore::fsext::{read_fs_list, MountInfo}; use uucore::fsext::{read_fs_list, MountInfo};
use uucore::parse_size::ParseSizeError; 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}; 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::filesystem::Filesystem;
use crate::table::Table; use crate::table::Table;
static ABOUT: &str = "Show information about the file system on which each FILE resides,\n\ const ABOUT: &str = help_about!("df.md");
or all file systems by default."; const USAGE: &str = help_usage!("df.md");
const USAGE: &str = "{} [OPTION]... [FILE]..."; const AFTER_HELP: &str = help_section!("after help", "df.md");
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).";
static OPT_HELP: &str = "help"; static OPT_HELP: &str = "help";
static OPT_ALL: &str = "all"; static OPT_ALL: &str = "all";
@ -487,7 +480,7 @@ pub fn uu_app() -> Command {
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.after_help(LONG_HELP) .after_help(AFTER_HELP)
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.arg( .arg(