当前位置:网站首页>一个酷酷的“幽灵”控制台工具
一个酷酷的“幽灵”控制台工具
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.删除指定的索引数据"
}));
边栏推荐
- How to design API interface and realize unified format return?
- Programmers go to work fishing, so play high-end!
- offer如何选择该考虑哪些因素
- STM32F103 realize IAP online upgrade application
- Chapter 9 Yunji datacanvas company won the highest honor of the "fifth digital finance innovation competition"!
- 九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
- Two divs are on the same line, and the two divs do not wrap "recommended collection"
- Flask project uses flask socketio exception: typeerror: function() argument 1 must be code, not str
- 装饰器基础学习02
- 第一篇论文的写作流程
猜你喜欢
A line of R code draws the population pyramid
[Android kotlin collaboration] use coroutinecontext to realize the retry logic after a network request fails
A row of code r shows the table of Cox regression model
5G VoNR+之IMS Data Channel概念
How to package the parsed Excel data into objects and write this object set into the database?
Depth first traversal template principle of tree and graph
深入解析Kubebuilder
深入解析Kubebuilder
Ansible报错:“msg“: “Invalid/incorrect password: Permission denied, please try again.“
一文搞懂常见的网络I/O模型
随机推荐
Leetcode minimum difference in student scores
Ansible reports an error: "MSG": "invalid/incorrect password: permission denied, please try again“
Markdown editor
Two methods of chromosome coordinate sequencing
Tiktok may launch an independent grass planting community platform: will it become the second little red book
A simple and beautiful regression table is produced in one line of code~
最全常用高数公式
npm ERR! 400 Bad Request - PUT xxx - “devDependencies“ dep “xx“ is not a valid dependency name
Camera calibration (I): robot hand eye calibration
Ansible报错:“msg“: “Invalid/incorrect password: Permission denied, please try again.“
[736. LISP syntax parsing]
关于01背包个人的一些理解
File upload vulnerability summary
组织实战攻防演练的5个阶段
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)
动态生成表格
Common Oracle SQL statements
[practice leads to truth] is the introduction of import and require really the same as what is said on the Internet
谈谈讲清楚这件事的重要性