W3cubDocs

/Nushell

fill for conversions

Fill and Align.

Signature

> fill {flags}

Flags

  • --width, -w {int}: The width of the output. Defaults to 1
  • --alignment, -a {string}: The alignment of the output. Defaults to Left (Left(l), Right(r), Center(c/m), MiddleRight(cr/mr))
  • --character, -c {string}: The character to fill with. Defaults to ' ' (space)

Input/output types:

input output
filesize string
int string
list<any> list<string>
list<filesize> list<string>
list<int> list<string>
list<number> list<string>
list<string> list<string>
number string
string string

Examples

Fill a string on the left side to a width of 15 with the character '─'

>'nushell'|fill-al-c'─'-w15
nushell────────

Fill a string on the right side to a width of 15 with the character '─'

>'nushell'|fill-ar-c'─'-w15
────────nushell

Fill a string on both sides to a width of 15 with the character '─'

>'nushell'|fill-am-c'─'-w15
────nushell────

Fill a number on the left side to a width of 5 with the character '0'

>1|fill--alignmentright--character'0'--width5
00001

Fill a number on both sides to a width of 5 with the character '0'

>1.1|fill--alignmentcenter--character'0'--width5
01.10

Fill a filesize on the left side to a width of 5 with the character '0'

>1kib|fill--alignmentmiddle--character'0'--width10
0001024000

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/fill.html