mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
feat: add always enabled to execution time
This commit is contained in:
parent
1777f1df38
commit
d5b41b37b2
|
@ -29,10 +29,10 @@ To use this, use the PowerShell module, or confirm that you are passing an `exec
|
|||
|
||||
## Properties
|
||||
|
||||
- always_enabled: `boolean` - always show the duration - defaults to `false`
|
||||
- threshold: `number` - minimum duration (milliseconds) required to enable this segment - defaults to `500`
|
||||
- style: `enum` - one of the available format options - defaults to `austin`
|
||||
|
||||
|
||||
## Style
|
||||
|
||||
Style specifies the format in which the time will be displayed. The table below shows some example times in each option.
|
||||
|
|
|
@ -37,9 +37,10 @@ const (
|
|||
)
|
||||
|
||||
func (t *executiontime) enabled() bool {
|
||||
alwaysEnabled := t.props.getBool(AlwaysEnabled, false)
|
||||
executionTimeMs := t.env.executionTime()
|
||||
thresholdMs := t.props.getFloat64(ThresholdProperty, float64(500))
|
||||
if executionTimeMs < thresholdMs {
|
||||
if !alwaysEnabled && executionTimeMs < thresholdMs {
|
||||
return false
|
||||
}
|
||||
style := DurationStyle(t.props.getString(Style, string(Austin)))
|
||||
|
|
|
@ -1145,6 +1145,12 @@
|
|||
"properties": {
|
||||
"properties": {
|
||||
"properties": {
|
||||
"always_enabled": {
|
||||
"type": "boolean",
|
||||
"title": "Always Enabled",
|
||||
"description": "Always show the duration",
|
||||
"default": false
|
||||
},
|
||||
"threshold": {
|
||||
"type": "number",
|
||||
"title": "Threshold",
|
||||
|
|
Loading…
Reference in a new issue