Add documentation and release notes for #10282

This commit is contained in:
Henrik Hørlück Berg 2024-02-11 12:43:13 +01:00
parent 4e6e897781
commit 59fa7479ee
No known key found for this signature in database
3 changed files with 10 additions and 1 deletions

View File

@ -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:

View File

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

View File

@ -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]