用颜色、格式和实用程序丰富您的CLI
spiffyline的Python项目详细描述
项目描述
spiffyline是一个提供格式化的终端实用程序包, 通过对ANSI SGR代码的抽象对终端输出进行着色。在
特点:
- 为便于使用而抽象ANSI SGR代码
- 用于快速格式化的预定义颜色
- 主题类合并SGR代码以重用
- 使添加格式和颜色简单简洁的实用方法
第页:
from spiffyline.theme import Theme
from spiffyline.logger import Logger
# Theme with bold and red text
my_theme = Theme.BOLD + Theme.fg_color( 230, 0, 0 )
print( my_theme + "Hello World!" + Theme.RESET )
# One can also use the Logger class for more concise code
l = Logger()
l.log( "Hello World!", my_theme )
# Or to record certain logging events
l.log( "Error", my_theme, flags=[ "error", ] )
print( l.events[ "error" ] ) # => 1
请从GitHub下载API Documentation
- 项目
标签: