当前位置:网站首页>一个酷酷的“幽灵”控制台工具
一个酷酷的“幽灵”控制台工具
2022-07-06 22:44:00 【InfoQ】
简介
- 全称:Spectre.Console
- 译名(非官方):幽灵控制台(以下简称幽灵)
特色
- 够新:上面提到的那些工具,或者一些没提到,但下载量都很大的工具,更新频率都很慢,想很火的ColorfulConsole,最近一次的更新都停在了2020年,所以尽管功能强大,但活力欠佳。而幽灵不一样,看官方的发行记录,他现在正处在快速的迭代更新中,最新的0.44.x版本,已经更新了13个小版本了,当然了,更新频繁也不见得是好事,也反映了问题很多,正在修修补补,但也正是这样,才证明它活力充沛,值得肯定!
- 够酷:这点不解释,看图
- 够强大:从上图也能看出来,幽灵提供了多种控制台打印风格,除了文字风格的处理,还支持,表格,树,进度条,甚至是emoji表情(需要修改系统配置)
使用
字体
AnsiConsole.MarkupLine($"[Yellow]我是第2个中间件,我来自入口文件,我过来了-{DateTime.Now}[/]");
AnsiConsole.MarkupLine("[bold]World[/]");
AnsiConsole.MarkupLine("[bold Yellow]World[/]");
表格
- 静态表格
var table = new Table().Centered();
table.AddColumn("被授权人ID");
table.AddColumn("被授权赛项ID");
table.AddColumn("授权人");
while (sdr.Read())
{
string column1 = Convert.ToString(sdr["UserID"]);
string column2 = Convert.ToString(sdr["TypeID"]);
string column3 = Convert.ToString(sdr["UserNam"]);
table.AddRow(column1, column2, column3);
}
AnsiConsole.Write(table);
//设置宽度
table.Width(50);
//设置偏移
table.Columns[0].PadLeft(3);
//设置边框,画个圈
table.Border(TableBorder.Square);
- 动态表格

FIGlet Text

AnsiConsole.Write(
new FigletText("Tony's Box")
.Centered()
.Color(Color.Blue)
);
选择
var cmd = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.Title("以下是工具箱暂时支持的操作?")
.PageSize(10)
.MoreChoicesText("[grey](请选择要执行的操作)[/]")
.AddChoices(new[] {
"1.监听【User_ProgramTypeLink】权限表","2.清除半年前的日志数据", "3.删除指定的索引数据"
}));
边栏推荐
- Using thread class and runnable interface to realize the difference between multithreading
- Analyse approfondie de kubebuilder
- [736. LISP syntax parsing]
- JS variable case
- Basic idea of counting and sorting
- 指针与数组在函数中输入实现逆序输出
- Chapter 9 Yunji datacanvas company has been ranked top 3 in China's machine learning platform market
- Ansible中的inventory主机清单(预祝你我有数不尽的鲜花和浪漫)
- [ArcGIS tutorial] thematic map production - population density distribution map - population density analysis
- What work items do programmers hate most in their daily work?
猜你喜欢
Flask项目使用flask-socketio异常:TypeError: function() argument 1 must be code, not str
JDBC link Oracle reference code
九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
Section 1: (3) logic chip process substrate selection
Vscode 如何使用内置浏览器?
Programmers go to work fishing, so play high-end!
批量归一化(标准化)处理
Meow, come, come: do you really know if, if else
【736. Lisp 语法解析】
IMS data channel concept of 5g vonr+
随机推荐
Depth first traversal template principle of tree and graph
高手勿进!写给初中级程序员以及还在大学修炼的“准程序员”的成长秘籍
Leetcode notes
【Android Kotlin协程】利用CoroutineContext实现网络请求失败后重试逻辑
Function pointer and pointer function in C language
Stm32f103ze+sht30 detection of ambient temperature and humidity (IIC simulation sequence)
Gavin teacher's perception of transformer live class - rasa project actual combat e-commerce retail customer service intelligent business dialogue robot microservice code analysis and dialogue experim
How does vscade use the built-in browser?
C语言中函数指针与指针函数
In depth analysis of kubebuilder
JS 的 try catch finally 中 return 的执行顺序
Servicemesh mainly solves three pain points
Ansible报错:“msg“: “Invalid/incorrect password: Permission denied, please try again.“
全国气象数据/降雨量分布数据/太阳辐射数据/NPP净初级生产力数据/植被覆盖度数据
The most complete learning rate adjustment strategy in history LR_ scheduler
STM32 encapsulates the one key configuration function of esp8266: realize the switching between AP mode and sta mode, and the creation of server and client
DFS and BFS concepts and practices +acwing 842 arranged numbers (DFS) +acwing 844 Maze walking (BFS)
Programmers go to work fishing, so play high-end!
National meteorological data / rainfall distribution data / solar radiation data /npp net primary productivity data / vegetation coverage data
When knative meets webassembly