用转义码魔术来改变你的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第三方库


热门话题
java变量始终存储0值。为什么?   如何使用Java/REST将Azure blob从一个存储容器移动到另一个存储容器?   java将commons DBCP从1.2升级到1.4,我应该害怕吗?   java如何使用分隔符拆分字符串?   java使用数组读取json对象   java在groovy中切片字符串   交换数组java的两个邻域元素   java移动用于确定字符串是否为回文的逻辑   java Android应用程序在一个活动中崩溃   java Sparkjava将webapp文件夹设置为静态资源/模板的文件夹   java复杂条件表达式,用户易用。   java如何仅在表存在时从表中选择值   java I无法将数据从Recyclerview传递到其他活动   java数据结构最佳设计(大数据)   java Android从DatePickerDialogFragment中删除日历视图   java将数据从Firebase获取到片段   数组。sort()在java中运行不正常