跳转到主内容

执行时间

非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

功能

显示上一条命令的执行耗时。

示例配置

{
"type": "executiontime",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#8800dd",
"template": " <#fefefe></> {{ .FormattedMs }} ",
"options": {
"threshold": 500,
"style": "austin",
"always_enabled": true
}
}

选项

NameTypeDefaultDescription
always_enabledbooleanfalsealways show the duration
thresholdint500minimum duration (milliseconds) required to enable this segment
styleenumaustinone of the available format options

样式

样式参数用于定义时间显示的格式。下表展示了不同选项对应的示例输出效果。

format0.001s2.1s3m2.1s4h3m2.1s
austin1ms2.1s3m 2.1s4h 3m 2.1s
roundrock1ms2s 100ms3m 2s 100ms4h 3m 2s 100ms
dallas0.0012.13:2.14:3:2.1
galveston00:00:0000:00:0200:03:0204:03:02
galvestonms00:00:00:00100:00:02:10000:03:02:10004:03:02:100
houston00:00:00.00100:00:02.100:03:02.104:03:02.1
amarillo0.001s2.1s182.1s14,582.1s
round1ms2s3m 2s4h 3m
lucky7    1ms 2.00s  3m  2s 4h  3m

模板 (信息)

默认模板
 {{ .FormattedMs }}

属性

NameTypeDescription
.Msnumberthe execution time in milliseconds
.FormattedMsstringthe formatted value based on the style above