1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

seq: implement -f FORMAT option

Add support for the `-f FORMAT` option to `seq`. This option instructs
the program to render each value in the generated sequence using a
given `printf`-style floating point format. For example,

    $ seq -f %.2f 0.0 0.1 0.5
    0.00
    0.10
    0.20
    0.30
    0.40
    0.50

Fixes issue #2616.
This commit is contained in:
Jeffrey Finkelstein 2022-01-25 20:45:10 -05:00
parent f1dde86f9b
commit 4fbe2b2b5e
3 changed files with 68 additions and 10 deletions

View file

@ -693,3 +693,11 @@ fn test_parse_error_hex() {
.fails()
.usage_error("invalid hexadecimal argument: '0xlmnop'");
}
#[test]
fn test_format_option() {
new_ucmd!()
.args(&["-f", "%.2f", "0.0", "0.1", "0.5"])
.succeeds()
.stdout_only("0.00\n0.10\n0.20\n0.30\n0.40\n0.50\n");
}