Padding

str_padding

Print a key-value pair separated by dot padding to fill the terminal width. Produces table-of-contents style output where titles and page numbers are dot-padded. Optionally override width with -w|--width.

Example

str_padding "Title" "Page1"        # => Title.........Page1
str_padding "Longer Title" "Page2" # => Longer Title...Page2

Arguments

  • $1 (string): Optional: -w|--width followed by column width
  • $2 (string): Left-side label (key)
  • $3 (string): Right-side value

Exit codes

  • 0: Always

Output on stdout

  • Dot-padded key-value line