|
| From: | Pádraig Brady |
| Subject: | Re: numfmt: Add option --space-separated |
| Date: | Thu, 9 Oct 2025 13:03:57 +0100 |
| User-agent: | Mozilla Thunderbird Beta |
On 09/10/2025 01:45, Collin Funk wrote:
Pádraig Brady <P@draigBrady.com> writes:On 08/10/2025 07:55, Jim Meyering wrote:On Wed, Oct 8, 2025 at 12:37 AM Pádraig Brady <P@draigbrady.com> wrote: ...Yes I think this feature is useful. I think the standards also mention a preference to avoid line breaks between numbers, and so NBSP might be good to support as an option also. So we could have an optional argument like: --suffix-space[=CHAR] Supporting: --suffix-space # ASCII space --suffix-space=$'\u00A0' # Non breaking space --suffix-space=$'\u202F' # Narrow NBSPMaybe --suffix-separator= or even just --separator= ?Yes that is more accurate. BTW, originally I envisaged that --format would be central to numfmt, and you would get the flexibility through its arguments. However currently we take anything after the "%f" as _after_ the suffix: $ printf '123412G 1234123G\n' | numfmt --from=auto --to=si --field=1,2 --format=$'[%f\u00A0]' [124T ] [ 1.3P ] Given any string is accepted after the %f directive, I'm not sure it's practical to change that now. So --suffix-separator seems like the best option.I find --separator to be easier to type than the other options. Can we just have it behave like 'seq --separator' does? $ seq --separator=abc 3 1abc2abc3 I don't see why you would want to use anything other than spaces, but I also don't see much point in limiting the separator to only spaces.
Agreed we should allow a string. To recap, processed numbers have 3 components. For e.g. "1.234GiB" has: float = 1.234 Unit = Gi Suffix = B So I suppose to be most accurate this would be --unit-separator. Suffix separation is already handled with the --suffix option. For e.g.: $ numfmt --to=si --to-unit=G --to=si --suffix=' billion' 12341324123412 13k billion Given we've field,unit,suffix separators then I think it's best to be specific with: --unit-separator=STRING I'll work on that for review. cheers, Padraig
| [Prev in Thread] | Current Thread | [Next in Thread] |