当前位置:网站首页>一个酷酷的“幽灵”控制台工具
一个酷酷的“幽灵”控制台工具
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.删除指定的索引数据"
}));
边栏推荐
- Field data acquisition and edge calculation scheme of CNC machine tools
- Run the command once per second in Bash- Run command every second in Bash?
- sscanf,sscanf_ S and its related usage "suggested collection"
- Chapter 9 Yunji datacanvas company won the highest honor of the "fifth digital finance innovation competition"!
- Vscode automatically adds a semicolon and jumps to the next line
- A row of code r shows the table of Cox regression model
- Some understandings about 01 backpacker
- STM32F103 realize IAP online upgrade application
- STM32F103ZE+SHT30检测环境温度与湿度(IIC模拟时序)
- When knative meets webassembly
猜你喜欢
Oracle -- 视图与序列
Function pointer and pointer function in C language
5G VoNR+之IMS Data Channel概念
[Android kotlin collaboration] use coroutinecontext to realize the retry logic after a network request fails
Section 1: (3) logic chip process substrate selection
Field data acquisition and edge calculation scheme of CNC machine tools
Time complexity & space complexity
How to design API interface and realize unified format return?
Camera calibration (I): robot hand eye calibration
How to choose an offer and what factors should be considered
随机推荐
NiO related knowledge points (I)
Thesis landing strategy | how to get started quickly in academic thesis writing
Vscode 如何使用内置浏览器?
一文搞懂常见的网络I/O模型
Ansible中的inventory主机清单(预祝你我有数不尽的鲜花和浪漫)
Weebly移动端网站编辑器 手机浏览新时代
【Android Kotlin协程】利用CoroutineContext实现网络请求失败后重试逻辑
STM32F103 realize IAP online upgrade application
组织实战攻防演练的5个阶段
JS variable case
leetcode 53. Maximum subarray maximum subarray sum (medium)
Windows are not cheap things
A detailed explanation of head pose estimation [collect good articles]
JS variable
JS variable case output user name
Field data acquisition and edge calculation scheme of CNC machine tools
Local tool [Navicat] connects to remote [MySQL] operation
Two divs are on the same line, and the two divs do not wrap "recommended collection"
Liste des hôtes d'inventaire dans ansible (je vous souhaite des fleurs et de la romance sans fin)
JS also exports Excel