def ljust_style(string, col, styles, lengths, fill=' '):
if not string:
string = ''
length = lengths[col]
unstyled = click.unstyle(string)
if len(unstyled) == len(string): # not already styled
if styles:
if col >= len(styles):
string = apply_style(styles[:-1], string) # apply last style for remaining fields
else:
string = apply_style(styles[col], string)
if len(unstyled) < length:
return string + fill * (length - len(unstyled))
return string
评论列表
文章目录