Add cool padding to re-written lines

This commit is contained in:
polyfloyd 2024-01-05 16:50:22 +01:00
parent 3511dd75ac
commit 5f6f9c52a7

View file

@ -16,11 +16,10 @@ def find_product_details(vendor_and_sku):
def update_product_pricings(src):
lines = src.split('\n')
find_updatable = re.compile(r'#\s*(?P<sku>\S+)\s+(?P<units>\d+)x$')
find_aliases = re.compile(r'^(?P<aliases>\S+)')
lines = src.split('\n')
lines_out = []
for line in lines:
@ -45,6 +44,6 @@ def update_product_pricings(src):
# Round up to 5ct.
unit_price = (unit_price * 20).quantize(Decimal('1'), rounding=ROUND_UP) / 20
lines_out.append(f'{aliases}\t{unit_price:.2f}\t{d["name"]} # {m["sku"]} {units}x')
lines_out.append(f'{aliases:<15} {unit_price:.2f} {d["name"]:<32} # {m["sku"]} {units}x')
return '\n'.join(lines_out)