From 59fa7479ee8df2dab3607172483a613114cc2753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20H=C3=B8rl=C3=BCck=20Berg?= <36937807+henrikhorluck@users.noreply.github.com> Date: Sun, 11 Feb 2024 12:43:13 +0100 Subject: [PATCH] Add documentation and release notes for #10282 --- CHANGELOG.rst | 1 + doc_src/cmds/string-repeat.rst | 9 ++++++++- doc_src/cmds/string.rst | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0de9296ce..7052d4584 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -70,6 +70,7 @@ Other improvements - An integer overflow in ``string repeat`` leading to a near-infinite loop has been fixed (:issue:`9899`). - ``string shorten`` behaves better in the presence of non-printable characters, including fixing an integer overflow that shortened strings more than intended. (:issue:`9854`) - ``string pad`` no longer allows non-printable characters as padding. (:issue:`9854`) +- ``string repeat`` now allows omission of ``-n`` when the first argument is an integer. (:issue:`10282`) .. _rust-packaging: diff --git a/doc_src/cmds/string-repeat.rst b/doc_src/cmds/string-repeat.rst index fdaf076d4..d16d0ec11 100644 --- a/doc_src/cmds/string-repeat.rst +++ b/doc_src/cmds/string-repeat.rst @@ -10,6 +10,7 @@ Synopsis string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [-N | --no-newline] [-q | --quiet] [STRING ...] + string repeat [-N | --no-newline] [-q | --quiet] COUNT [STRING ...] .. END SYNOPSIS @@ -18,7 +19,7 @@ Description .. BEGIN DESCRIPTION -``string repeat`` repeats the *STRING* **-n** or **--count** times. The **-m** or **--max** option will limit the number of outputted characters (excluding the newline). This option can be used by itself or in conjunction with **--count**. If both **--count** and **--max** are present, max char will be outputed unless the final repeated string size is less than max, in that case, the string will repeat until count has been reached. Both **--count** and **--max** will accept a number greater than or equal to zero, in the case of zero, nothing will be outputed. If **-N** or **--no-newline** is given, the output won't contain a newline character at the end. Exit status: 0 if yielded string is not empty, 1 otherwise. +``string repeat`` repeats the *STRING* **-n** or **--count** times. The **-m** or **--max** option will limit the number of outputted characters (excluding the newline). This option can be used by itself or in conjunction with **--count**. If both **--count** and **--max** are present, max char will be outputed unless the final repeated string size is less than max, in that case, the string will repeat until count has been reached. Both **--count** and **--max** will accept a number greater than or equal to zero, in the case of zero, nothing will be outputed. The first argument is interpreted as *COUNT* if **--count** or **--max** are not explicilty specified. If **-N** or **--no-newline** is given, the output won't contain a newline character at the end. Exit status: 0 if yielded string is not empty, 1 otherwise. .. END DESCRIPTION @@ -44,4 +45,10 @@ Repeat Examples >_ string repeat -m 5 'foo' foofo + >_ string repeat 2 'foo' + foofoo + + >_ string repeat 2 -n 3 + 222 + .. END EXAMPLES diff --git a/doc_src/cmds/string.rst b/doc_src/cmds/string.rst index 621e8e083..251d2effa 100644 --- a/doc_src/cmds/string.rst +++ b/doc_src/cmds/string.rst @@ -22,6 +22,7 @@ Synopsis [STRING ...] string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [-N | --no-newline] [-q | --quiet] [STRING ...] + string repeat [-N | --no-newline] [-q | --quiet] COUNT [STRING ...] string replace [-a | --all] [-f | --filter] [-i | --ignore-case] [-r | --regex] [-q | --quiet] PATTERN REPLACE [STRING ...] string shorten [(-c | --char) CHARS] [(-m | --max) INTEGER]