Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

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:

inputoutput
intstring
floatstring
stringstring
filesizestring
list<int>list<string>
list<float>list<string>
list<string>list<string>
list<filesize>list<string>
list<any>list<string>

Examples

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

> 'nushell' | fill --alignment l --character '─' --width 15
nushell────────

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

> 'nushell' | fill --alignment r --character '─' --width 15
────────nushell

Fill an empty string with 10 '─' characters

> '' | fill --character '─' --width 10
──────────

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

> 1 | fill --alignment right --character '0' --width 5
00001

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

> 1.1 | fill --alignment center --character '0' --width 5
01.10

Fill a filesize on both sides to a width of 10 with the character '0'

> 1kib | fill --alignment middle --character '0' --width 10
0001024000