命令行工具美化程序。

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 OnResizeListener或OnDrawListener或类似的东西   java Orika映射嵌套子列表   保存时java Heroku请求超时代码H12   数据库在Java中出现socket读取超时异常的原因是什么?   java如何更改来自Sqlite数据库的特定数据在Listview中的行颜色   java JAXB解组器无法正确处理XML中的列表   java Android日期时区让我抓狂   java不透明属性在Swing中如何工作?   eclipse从JavaEE代码生成流程图   java如何在Hibernate中从相关表中获取计数   java Glassfish部署了项目的依赖项库   java使内容适合JavaFx中的WebView   java不满意的链接错误libcrypto。所以1.0.0   循环中java数组的使用   java找出哪个包调用服务