Files
littlefs/scripts
Christopher Haster 97470c9930 scripts: Added punescape repetition + nesting
Maybe a bit overkill, but I needed more flexibility around adding
arbitrary whitespace.

New modifiers:

  %s                    A space
  %{                    Start a substring
  %}s                   End and format a subtring
  %aaa[mod]             Repeat this mod aaa times

With this, it's easy to add arbitrary spaces:

  "%8s" -> "        "

Or equivalently:

  "%8{ %}s" -> "        "

Which allows arbitrary repitition of any substring:

  "%4{hi!%}s" -> "hi!hi!hi!hi!"

This substring modifier includes its own format string, which allows for
some really nice padding normally impossible in printf:

  "%{%(a)d/%(b)d%}8s" % {a:1,b:2}   -> "     1/2"
  "%{%(a)d/%(b)d%}8s" % {a:12,b:34} -> "   12/34"
2026-03-09 22:57:15 -05:00
..
2025-04-16 15:23:06 -05:00