用转义码魔术来改变你的shell输出!

swag的Python项目详细描述


用转义码魔法给外壳输出上色。

Demo

演示

安装

pip install swag

用法

usage: swag [-h] {print,install} ...

positional arguments:
  {print,install}  [command] help
    install        install the colors to the folder of choice
    print          prints the text with the specified color and type to the
                   console

optional arguments:
  -h, --help       show this help message and exit

原始使用量

使用源代码

from swag import colors
print colors.COLORS["red"], "This will be red"
# Or use the swagprinter helpers:

from swag import swagprinter
from swag.swagprinter import INTENSE

swagprinter.print_green("Blah", INTENSE) # Prints an intense green

# Prints an intense green, to the end of the output:
swagprinter.print_green("Blah", INTENSE, true)

安装到文件夹

从命令行do

swag install -d <path/to/folder> # default is ~/.colors

这将把所有转义码安装到~/.colors或文件夹中。

现在您可以通过:

echo $(cat ~/.colors/blue) This will be blue

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

推荐PyPI第三方库


热门话题
jsp错误:包net。旧金山。jasperreports。发动机JAVA中不存在设计   python PySpark未初始化   而Java中的循环并没有按我所希望的那样工作   jframe我在线程“AWTEventQueue0”java中遇到异常。lang.NumberFormatException:用于输入字符串:“年:”   java无法解析符号页   java分割包含问号和等号的字符串的最佳方法   java使用hibernate everytime查询oracle视图结果为空   拆分如何在java中提取两个字符之间的数据   java将链表的头部移动到尾部   java无法根据从数据库检索到的值设置微调器位置   java在SpringBoot中有什么方法可以控制关闭机制吗?   在Java8中,使用ValueComparator按值对Map<Integer,Float>进行排序会产生错误   java Eclipselink持久关系表创建选择   java将图像保留在图像视图位置   新安装的Neo4J服务器首次运行时出现linux java权限错误   java SQL插入与枚举?   javaswt标签中的透明背景