命令行工具美化程序。

ecstas的Python项目详细描述


https://travis-ci.org/goldsborough/ecstasy.svg?branch=masterhttps://img.shields.io/github/license/mashape/apistatus.svghttps://badge.fury.io/py/ecstasy.svghttps://coveralls.io/repos/goldsborough/ecstasy/badge.svg?branch=master&service=githubhttps://landscape.io/github/goldsborough/ecstasy/master/landscape.svg?style=flathttps://codeclimate.com/github/goldsborough/ecstasy/badges/gpa.svghttp://img.shields.io/gratipay/goldsborough.svg

狂喜在这里,使您的命令行工具美丽和花哨。

命令行工具的输出没有摇头丸:

https://raw.githubusercontent.com/goldsborough/ecstasy/master/docs/img/without.png

命令行工具的输出带有(on?)狂喜:

https://raw.githubusercontent.com/goldsborough/ecstasy/master/docs/img/with.gif

用法

要使用摇头丸,您可以使用摇头丸的特殊语法标记一个标准的python字符串,选择一些时髦的样式和格式标志,将它们传递给package-level beautiffy()方法,作为回报,获得您美化的字符串,准备好在打印到命令行时踢屁股:

importecstasy# <...> is a normal phrase, its style is determined by its position# <(x)...> is a phrase with an argument, its style is the one at index 'x'# <<...> <...>> is a phrase with nested phrases, their styles cascadetext="<Cats> are <(0)just> <<small>, furry <elephants>>!"# Beautify text by specifying styles via flag combinationstext=ecstasy.beautify(text,ecstasy.Style.Blink|ecstasy.Color.Red,ecstasy.Style.Bold|ecstasy.Fill.Blue,ecstasy.Color.Magenta|ecstasy.Style.Underline,small=ecstasy.Style.Invert|ecstasy.Color.White)# Keyword arguments (small=...) cause all phrases matching the string of# the key to have the style specified by the keyword argument's value.print(text)

在命令行输出的脚本中运行此命令:

https://raw.githubusercontent.com/goldsborough/ecstasy/master/docs/img/usage.gif

安装

现在您确信,可以使用pip安装摇头丸:

$ pip install ecstasy

…然后开始干。

Documentation

完整的文档和用法说明,指定了所有可能的选项以及如何使用摇头丸美化字符串的可能性,可以在here中找到。

兼容性

python版本

使用Python3.4和Python2.7构建。此外,还成功地移植到Python2.6、3.2和3.3并用它进行了测试。看看Travis有什么要说的。

终端支持

与你的mac终端一起工作。有关更多信息,请享用这张桌子:

TerminalBoldDimUnderlinedBlinkInvertHiddenColor
aTermXXX
Eterm(1)XXX
GNOMEX
GuakeX
KonsoleXX
NautilusX
rxvtX(2)X
TerminatorX
TildaXXX
XFCE4X
XTermX
xvtXXXX
Linux TTYXXXX
VTEX

(1)用浅色代替粗体。

(2)用浅色代替闪烁。

License

摇头丸在MIT license下释放。

作者

彼得戈德斯伯勒cat:心:

Join the chat at https://gitter.im/goldsborough/ecstasy

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Spring启动,状态404,错误“未找到”   JavaSpringBoot(使用SpringMVC)在默认错误响应中停止发送正文(可能在版本更新之后)   如何设置ehcache的位置。基于java的spring配置中的xml?   java调用函数在服务器中设置数组,在客户端打印数组   java如何知道mousePressed()事件何时发生?   java不在unitest中启动spring上下文   java生成无随机类的4位数   java从Android中的文本文件中的特定行获取特定单词   java ANTLR:以编程方式运行解析器时忽略语法错误   java自定义卡片视图形状   java如何保存自定义微调器状态   Java线程本地weakReference   ResultSet的java Can getString()方法可用于从MySQL表获取文本类型列的值?