Skip to content

Commit

Permalink
numfmt: update help to markdown syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam authored and sylvestre committed Nov 20, 2022
1 parent cf43659 commit f75d5ea
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
46 changes: 23 additions & 23 deletions src/uu/numfmt/numfmt.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ numfmt [OPTION]... [NUMBER]...

Convert numbers from/to human-readable strings

## Long Help
## After Help

UNIT options:
none no auto-scaling is done; suffixes will trigger an error
`UNIT` options:
- `none`: no auto-scaling is done; suffixes will trigger an error
- `auto`: accept optional single/two letter suffix:

auto accept optional single/two letter suffix:
1K = 1000, 1Ki = 1024, 1M = 1000000, 1Mi = 1048576,

1K = 1000, 1Ki = 1024, 1M = 1000000, 1Mi = 1048576,
- `si`: accept optional single letter suffix:

si accept optional single letter suffix:
1K = 1000, 1M = 1000000, ...

1K = 1000, 1M = 1000000, ...
- `iec`: accept optional single letter suffix:

iec accept optional single letter suffix:
1K = 1024, 1M = 1048576, ...

1K = 1024, 1M = 1048576, ...
- `iec-i`: accept optional two-letter suffix:

iec-i accept optional two-letter suffix:
1Ki = 1024, 1Mi = 1048576, ...

1Ki = 1024, 1Mi = 1048576, ...
`FIELDS` supports `cut(1)` style field ranges:

FIELDS supports cut(1) style field ranges:
N N'th field, counted from 1
N- from N'th field, to end of line
N-M from N'th to M'th field (inclusive)
-M from first to M'th field (inclusive)
- all fields
Multiple fields/ranges can be separated with commas
N N'th field, counted from 1
N- from N'th field, to end of line
N-M from N'th to M'th field (inclusive)
-M from first to M'th field (inclusive)
- all fields

FORMAT must be suitable for printing one floating-point argument '%f'.
Optional quote (%'f) will enable --grouping (if supported by current locale).
Optional width value (%10f) will pad output. Optional zero (%010f) width
will zero pad the number. Optional negative values (%-10f) will left align.
Optional precision (%.1f) will override the input determined precision.
Multiple fields/ranges can be separated with commas

`FORMAT` must be suitable for printing one floating-point argument `%f`.
Optional quote (`%'f`) will enable --grouping (if supported by current locale).
Optional width value (`%10f`) will pad output. Optional zero (`%010f`) width
will zero pad the number. Optional negative values (`%-10f`) will left align.
Optional precision (`%.1f`) will override the input determined precision.
4 changes: 2 additions & 2 deletions src/uu/numfmt/src/numfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub mod options;
mod units;

const ABOUT: &str = help_section!("about", "numfmt.md");
const LONG_HELP: &str = help_section!("long help", "numfmt.md");
const AFTER_HELP: &str = help_section!("after help", "numfmt.md");
const USAGE: &str = help_usage!("numfmt.md");

fn handle_args<'a>(args: impl Iterator<Item = &'a str>, options: &NumfmtOptions) -> UResult<()> {
Expand Down Expand Up @@ -262,7 +262,7 @@ pub fn uu_app() -> Command {
Command::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.after_help(LONG_HELP)
.after_help(AFTER_HELP)
.override_usage(format_usage(USAGE))
.allow_negative_numbers(true)
.infer_long_args(true)
Expand Down

0 comments on commit f75d5ea

Please sign in to comment.