mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
docs: add template information
This commit is contained in:
parent
0373d2c507
commit
b4292e2e50
|
@ -49,7 +49,7 @@ The configuration has the following properties:
|
|||
- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the
|
||||
properties below - defaults to `{{ .Shell }}> `
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
- `.Root`: `boolean` - is the current user root/admin or not
|
||||
- `.PWD`: `string` - the current working directory
|
||||
|
|
|
@ -30,7 +30,17 @@ Display the currently active Angular CLI version.
|
|||
- `always`: the segment is always displayed
|
||||
- `files`: the segment is only displayed when `angular.json` file is present (default)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -29,7 +29,17 @@ Display the currently active AWS profile and region.
|
|||
- display_default: `boolean` - display the segment or not when the user profile matches `default` - defaults
|
||||
to `true`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Profile`: `string` - the currently active profile
|
||||
- `.Region`: `string` - the currently active region
|
||||
|
|
|
@ -14,7 +14,7 @@ Display the currently active Azure subscription information.
|
|||
{
|
||||
"type": "az",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\uE0B0",
|
||||
"powerline_symbol": "\uE0B0",
|
||||
"foreground": "#000000",
|
||||
"background": "#9ec3f0",
|
||||
"properties": {
|
||||
|
@ -24,7 +24,17 @@ Display the currently active Azure subscription information.
|
|||
}
|
||||
```
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Name }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.EnvironmentName`: `string` - the account environment name
|
||||
- `.HomeTenantID`: `string` - the home tenant id
|
||||
|
@ -33,7 +43,7 @@ Display the currently active Azure subscription information.
|
|||
- `.Name`: `string` - the account name
|
||||
- `.State`: `string` - the account state
|
||||
- `.TenantID`: `string` - the tenant id
|
||||
- `.UserName`: `string` - the user name
|
||||
- `.User.Name`: `string` - the user name
|
||||
- `.Origin`: `string` - where we received the information from, can be `CLI` or `PWSH`
|
||||
|
||||
[templates]: /docs/config-templates
|
||||
|
|
|
@ -34,7 +34,17 @@ Display the currently active Azure functions CLI version.
|
|||
- `always`: the segment is always displayed
|
||||
- `files`: the segment is only displayed when a `host.json` or `local.settings.json` files is present (default)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -39,7 +39,17 @@ Battery displays the remaining power percentage for your battery.
|
|||
- discharging_icon: `string` - icon to display on the left when discharging - defaults to empty
|
||||
- charged_icon: `string` - icon to display on the left when fully charged - defaults to empty
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.State`: `struct` - the battery state, has a `.String` function
|
||||
- `.Current`: `float64` - Current (momentary) charge rate (in mW).
|
||||
|
|
|
@ -68,7 +68,17 @@ You can override the default icons for batch status as used by template property
|
|||
- completed_status_icon
|
||||
- archived_status_icon
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .StatusIcon }} {{ if .DaysBottledOrFermented }}{{ .DaysBottledOrFermented }}{{ .DayIcon }} {{ end }}{{ url .Recipe.Name .URL }} {{ printf \"%.1f\" .MeasuredAbv }}%{{ if and (.Reading) (eq .Status \"Fermenting\") }} {{ printf \"%.3f\" .Reading.Gravity }} {{ .Reading.Temperature }}\u00b0 {{ .TemperatureTrendIcon }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
Commonly used fields
|
||||
|
||||
|
|
|
@ -45,7 +45,17 @@ error). The `&&` functionality will join the output of the commands when success
|
|||
- shell: `string` - the shell in which to run the command in. Uses `shell -c command` under the hood.
|
||||
- command: `string` - the command(s) to run
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Output }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Output`: `string` - the output of the command.
|
||||
|
||||
|
|
|
@ -33,7 +33,17 @@ Display the currently active crystal version.
|
|||
- `always`: the segment is always displayed
|
||||
- `files`: the segment is only displayed when `*.cr` or `shard.yml` files are present (default)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -34,7 +34,17 @@ Display the currently active dart version.
|
|||
- `files`: the segment is only displayed when `*.dart`, `pubspec.yaml`, `pubspec.yml`, `pubspec.lock` files or the `.dart_tool`
|
||||
folder are present (default)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -36,7 +36,17 @@ Display the currently active .NET SDK version.
|
|||
or `*.fsproj` files are present (default)
|
||||
- version_url_template: `string` - A go text/template [template][templates] that creates the changelog URL
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Unsupported }}\uf071{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -49,7 +49,17 @@ Style specifies the format in which the time will be displayed. The table below
|
|||
| amarillo | `0.001s` | `2.1s` | `182.1s` | `14,582.1s` |
|
||||
| round | `1ms` | `2s` | `3m 2s` | `4h 3m` |
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .FormattedMs }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Ms`: `number` - the execution time in milliseconds
|
||||
- `.FormattedMs`: `string` - the formatted value based on the `style` above.
|
||||
|
|
|
@ -35,7 +35,17 @@ Displays the last exit code or that the last command failed based on the configu
|
|||
|
||||
[colors]: /docs/config-colors
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if gt .Code 0 }}\uf00d {{ .Meaning }}{{ else }}\uf42e{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Code`: `number` - the last known exit code
|
||||
- `.Meaning`: `string` - the textual meaning linked to exit code (if applicable, otherwise identical to `.Code`)
|
||||
|
|
|
@ -93,7 +93,17 @@ You can set the following properties to `true` to enable fetching additional inf
|
|||
- azure_devops_icon: `string` - icon/text to display when the upstream is Azure DevOps - defaults to `\uFD03 `
|
||||
- git_icon: `string` - icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB `
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }} \uF044 {{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uF046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}} \uF692 {{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Working`: `GitStatus` - changes in the working tree (see below)
|
||||
- `.Staging`: `GitStatus` - staged changes in the work tree (see below)
|
||||
|
|
|
@ -34,7 +34,17 @@ Display the currently active golang version.
|
|||
- `files`: the segment is only displayed when `*.go` or `go.mod` files are present (default)
|
||||
- parse_mod_file: `boolean`: parse the go.mod file instead of calling `go version`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -34,7 +34,17 @@ sidebar_label: Ipify
|
|||
- cache_timeout: `int` in minutes - How long do you want your IP address cached? -
|
||||
defaults to 10 min
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .IP }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- .IP: `string` - Your external IP address
|
||||
|
||||
|
|
|
@ -46,7 +46,17 @@ Display the currently active java version.
|
|||
- `*.clj`
|
||||
- `*.cljc`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -33,7 +33,17 @@ Display the currently active julia version.
|
|||
- `always`: the segment is always displayed
|
||||
- `files`: the segment is only displayed when `*.jl` files are present (default)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -30,7 +30,17 @@ Display the currently active Kubernetes context name and namespace name.
|
|||
- parse_kubeconfig: `boolean` - parse kubeconfig files instead of calling out to kubectl to improve
|
||||
performance - defaults to `false`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Context }}{{ if .Namespace }} :: {{ .Namespace }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Context`: `string` - the current kubectl context
|
||||
- `.Namespace`: `string` - the current kubectl context namespace
|
||||
|
|
|
@ -27,7 +27,17 @@ The Nerdbank.GitVersioning CLI can be a bit slow causing the prompt to feel slow
|
|||
}
|
||||
```
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Version }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Version`: `string` - the current version
|
||||
- `.AssemblyVersion`: `string` - the current assembly version
|
||||
|
|
|
@ -45,7 +45,7 @@ if that color is visible against any of your backgrounds.
|
|||
"properties": {
|
||||
"url": "https://YOURNIGHTSCOUTAPP.herokuapp.com/api/v1/entries.json?count=1&token=APITOKENFROMYOURADMIN",
|
||||
"http_timeout": 1500,
|
||||
"template": " {{.Sgv}}{{.TrendIcon}}"
|
||||
"template": "\ue2a1 {{ .Sgv }}{{ .TrendIcon }}"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -53,7 +53,7 @@ if that color is visible against any of your backgrounds.
|
|||
Or display in mmol/l (instead of the default mg/dl) with the following template:
|
||||
|
||||
```json
|
||||
"template": " {{ if eq (mod .Sgv 18) 0 }}{{divf .Sgv 18}}.0{{ else }} {{ round (divf .Sgv 18) 1 }}{{ end }}{{.TrendIcon}}"
|
||||
"template": "\ue2a1 {{ if eq (mod .Sgv 18) 0 }}{{divf .Sgv 18}}.0{{ else }} {{ round (divf .Sgv 18) 1 }}{{ end }}{{ .TrendIcon }}"
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
@ -79,7 +79,17 @@ Or display in mmol/l (instead of the default mg/dl) with the following template:
|
|||
- SingleDownIcon - defaults to ↓
|
||||
- DoubleDownIcon - defaults to ↓↓
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Sgv }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- .ID: `string` - The internal ID of the object
|
||||
- .Sgv: `int` - Your Serum Glucose Value (your sugar)
|
||||
|
|
|
@ -34,7 +34,17 @@ Display the currently active node version.
|
|||
- yarn_icon: `string` - the icon/text to display when using Yarn - defaults to ` \uF61A`
|
||||
- npm_icon: `string` - the icon/text to display when using NPM - defaults to ` \uE71E`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -49,8 +49,18 @@ Display OS specific info - defaults to Icon.
|
|||
- slackware: `string` - the icon to use for Slackware - defaults to Slackware icon - defaults to `\uF319`
|
||||
- ubuntu: `string` - the icon to use for Ubuntu - defaults to Ubuntu icon - defaults to `\uF31b`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
- `.OS`: `string` - the OS platform
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .WSL }}WSL at {{ end }}{{.Icon}}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Icon`: `string` - the OS icon
|
||||
|
||||
[templates]: /docs/config-templates
|
||||
|
|
|
@ -47,7 +47,17 @@ The free tier for *Current weather and forecasts collection* is sufficient.
|
|||
- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the
|
||||
properties below - defaults to `{{.Weather}} ({{.Temperature}}{{.UnitIcon}})`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Weather }} ({{ .Temperature }}{{ .UnitIcon }})
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Weather`: `string` - the current weather icon
|
||||
- `.Temperature`: `string` - the current temperature
|
||||
|
|
|
@ -121,9 +121,19 @@ starts with a symbol or icon.
|
|||
- `__pycache__` will be shortened to `__p`
|
||||
- `➼ folder` will be shortened to `➼ f`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
- `.Path`: `string` - the current directory (styled)
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Path }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Path`: `string` - the current directory (based on the `style` property)
|
||||
- `.StackCount`: `int` - the stack count
|
||||
|
||||
[templates]: /docs/config-templates
|
||||
|
|
|
@ -33,7 +33,17 @@ Display the currently active php version.
|
|||
- `always`: the segment is always displayed
|
||||
- `files`: the segment is only displayed when `*.php, composer.json, composer.lock, .php-version` files are present (default)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -71,7 +71,17 @@ You can set the following property to `true` to enable fetching additional infor
|
|||
- commit_icon: `string` - icon/text to display before the commit context (detached HEAD) - defaults to `\uF417`
|
||||
- tag_icon: `string` - icon/text to display before the tag context - defaults to `\uF412`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Selector }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Selector`: `string` - the current selector context (branch/changeset/label)
|
||||
- `.Behind`: `bool` - the current workspace is behind and changes are incoming
|
||||
|
|
|
@ -25,7 +25,17 @@ To enable the `posh-git` module, set `$env:POSH_GIT_ENABLED = $true` in your `$P
|
|||
}
|
||||
```
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Status }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Status`: `string` - the status reported from posh-git
|
||||
|
||||
|
|
|
@ -40,7 +40,17 @@ or not - defaults to `true`
|
|||
- `environment`: the segment is only displayed when a virtual env is present
|
||||
- `context`: the segment is only displayed when either `environment` or `files` is active
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Venv`: `string` - the virtual environment name (if present)
|
||||
- `.Full`: `string` - the full version
|
||||
|
|
|
@ -22,3 +22,15 @@ Show when the current user is root or when in an elevated shell (Windows).
|
|||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
\uF0E7
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
[templates]: /docs/config-templates
|
||||
|
|
|
@ -33,7 +33,17 @@ Display the currently active ruby version.
|
|||
- `always`: the segment is always displayed
|
||||
- `files`: the segment is only displayed when `*.rb`, `Gemfile` or `Rakefile` files are present (default)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -33,7 +33,17 @@ Display the currently active rust version.
|
|||
- `always`: the segment is always displayed
|
||||
- `files`: the segment is only displayed when `*.rs`, `Cargo.toml` or `Cargo.lock` files are present (default)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - major number
|
||||
|
|
|
@ -24,7 +24,17 @@ Show the current user and host name.
|
|||
}
|
||||
```
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }}@{{ .HostName }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.UserName`: `string` - the current user's name
|
||||
- `.HostName`: `string` - the current computer's name
|
||||
|
|
|
@ -29,7 +29,17 @@ Show the current shell name (ZSH, powershell, bash, ...).
|
|||
|
||||
- mapped_shell_names: `object` - custom glyph/text to use in place of specified shell names (case-insensitive)
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Name }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Name`: `string` - the shell name
|
||||
|
||||
|
|
|
@ -35,7 +35,17 @@ On macOS, all states are supported (playing/paused/stopped).
|
|||
- paused_icon: `string` - text/icon to show when paused - defaults to `\uF8E3 `
|
||||
- stopped_icon: `string` - text/icon to show when stopped - defaults to `\uF04D `
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Status`: `string` - player status (`playing`, `paused`, `stopped`)
|
||||
- `.Artist`: `string` - current artist
|
||||
|
|
|
@ -69,7 +69,17 @@ if that color is visible against any of your backgrounds.
|
|||
- WorkOutIcon - defaults to `\ue213`
|
||||
- UnknownActivityIcon - defaults to `\ue213`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}{{ .Ago }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
The properties below are available for use in your template
|
||||
|
||||
|
|
|
@ -31,7 +31,17 @@ Display SysInfo.
|
|||
|
||||
- Precision: `int` - The precision used for any float values - defaults to 2
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ round .PhysicalPercentUsed .Precision }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.PhysicalTotalMemory`: `int` - is the total of used physical memory
|
||||
- `.PhysicalFreeMemory`: `int` - is the total of free physical memory
|
||||
|
|
|
@ -27,7 +27,17 @@ This requires a terraform binary in your PATH and will only show in directories
|
|||
}
|
||||
```
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .WorkspaceName }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.WorkspaceName`: `string` - is the current workspace name
|
||||
|
||||
|
|
|
@ -35,7 +35,17 @@ New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global -Force
|
|||
|
||||
:::
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Text }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Root`: `boolean` - is the current user root/admin or not
|
||||
- `.Path`: `string` - the current working directory
|
||||
|
|
|
@ -25,11 +25,22 @@ Show the current timestamp.
|
|||
|
||||
- time_format: `string` - format to use, follows the [golang standard][format] - defaults to `15:04:05`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
- `.CurrentDate`: `time` - The time to display(testing purpose)
|
||||
:::note default template
|
||||
|
||||
### Standard time and date formats
|
||||
``` template
|
||||
{{ .CurrentDate | date .Format }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Format`: `string` - The time format (set via `time_format`)
|
||||
- `.CurrentDate`: `time` - The time to display (testing purpose)
|
||||
|
||||
## Standard time and date formats
|
||||
|
||||
- January 2, 2006 **Date**
|
||||
- 01/02/06
|
||||
|
@ -46,7 +57,7 @@ Show the current timestamp.
|
|||
- Mon, 02 Jan 2006 15:04:05 MST 27e95cb
|
||||
- Mon, 02 Jan 2006 15:04:05 -0700 **with numeric zone**
|
||||
|
||||
#### The following predefined date and timestamp format constants are also available
|
||||
### The following predefined date and timestamp format constants are also available
|
||||
|
||||
- ANSIC = "Mon Jan _2 15:04:05 2006"
|
||||
- UnixDate = "Mon Jan _2 15:04:05 MST 2006"
|
||||
|
|
|
@ -40,11 +40,21 @@ works if you can curl it yourself and a result. - defaults to ``
|
|||
- http_timeout: `int` - The default timeout for http request is 20ms. If no segment is shown, try increasing this timeout.
|
||||
- cache_timeout: `int` - The default timeout for request caching is 10m. A value of 0 disables the cache.
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ secondsRound .CummulativeTotal.Seconds }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.CummulativeTotal`: `wtTotals` - object holding total tracked time values
|
||||
|
||||
### wtTotal Properties
|
||||
### wtTotals Properties
|
||||
|
||||
- `.Seconds`: `int` - a number reprecenting the total tracked time in seconds
|
||||
- `.Text`: `string` - a string with human readable tracked time (eg: "2 hrs 30 mins")
|
||||
|
|
|
@ -30,7 +30,17 @@ Currently only supports Windows and WSL. Pull requests for Darwin and Linux supp
|
|||
}
|
||||
```
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ if .Error }}{{ .Error }}{{ else }}\uFAA8 {{ .SSID }} {{ .Signal }}% {{ .ReceiveRate }}Mbps{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.SSID`: `string` - the SSID of the current wifi network
|
||||
- `.RadioType`: `string` - the radio type - _e.g. 802.11ac, 802.11ax, 802.11n, etc._
|
||||
|
|
|
@ -38,7 +38,17 @@ Supported registry key types:
|
|||
Ending path with \ will get the (Default) key from that path.
|
||||
- fallback: `string` - the value to fall back to if no entry is found
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Value }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- .Value: `string` - The result of your query, or fallback if not found.
|
||||
|
||||
|
|
|
@ -38,7 +38,17 @@ Remote Control password.
|
|||
- stopped_icon: `string` - text/icon to show when paused - defaults to `\uF04D `
|
||||
- api_url: `string` - the YTMDA Remote Control API URL- defaults to `http://127.0.0.1:9863`
|
||||
|
||||
## [Template][templates] Properties
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
``` template
|
||||
{{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
- `.Status`: `string` - player status (`playing`, `paused`, `stopped`)
|
||||
- `.Artist`: `string` - current artist
|
||||
|
|
|
@ -28,7 +28,7 @@ const (
|
|||
)
|
||||
|
||||
func (b *Battery) Template() string {
|
||||
return "{{ if not .Error }}{{.Icon}}{{.Percentage}}{{ end }}{{.Error}}"
|
||||
return "{{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}"
|
||||
}
|
||||
|
||||
func (b *Battery) Enabled() bool {
|
||||
|
|
|
@ -55,10 +55,6 @@ const (
|
|||
|
||||
BFCacheTimeout properties.Property = "cache_timeout"
|
||||
|
||||
DefaultTemplate string = "{{.StatusIcon}} {{if .DaysBottledOrFermented}}{{.DaysBottledOrFermented}}{{.DayIcon}} {{end}}[{{.Recipe.Name}}]({{.URL}})" +
|
||||
" {{printf \"%.1f\" .MeasuredAbv}}%{{ if and (.Reading) (eq .Status \"Fermenting\")}} " +
|
||||
"{{printf \"%.3f\" .Reading.Gravity}} {{.Reading.Temperature}}\u00b0 {{.TemperatureTrendIcon}}{{end}}"
|
||||
|
||||
BFStatusPlanning string = "Planning"
|
||||
BFStatusBrewing string = "Brewing"
|
||||
BFStatusFermenting string = "Fermenting"
|
||||
|
@ -101,7 +97,7 @@ type Batch struct {
|
|||
}
|
||||
|
||||
func (bf *Brewfather) Template() string {
|
||||
return DefaultTemplate
|
||||
return "{{ .StatusIcon }} {{ if .DaysBottledOrFermented }}{{ .DaysBottledOrFermented }}{{ .DayIcon }} {{ end }}{{ url .Recipe.Name .URL }} {{ printf \"%.1f\" .MeasuredAbv }}%{{ if and (.Reading) (eq .Status \"Fermenting\") }} {{ printf \"%.3f\" .Reading.Gravity }} {{ .Reading.Temperature }}\u00b0 {{ .TemperatureTrendIcon }}{{ end }}" // nolint:lll
|
||||
}
|
||||
|
||||
func (bf *Brewfather) Enabled() bool {
|
||||
|
|
|
@ -29,56 +29,56 @@ func TestNSSegment(t *testing.T) {
|
|||
Case: "Flat 150",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":150,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"Flat","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 150→",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 150→",
|
||||
ExpectedEnabled: true,
|
||||
},
|
||||
{
|
||||
Case: "DoubleDown 50",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":50,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"DoubleDown","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 50↓↓",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 50↓↓",
|
||||
ExpectedEnabled: true,
|
||||
},
|
||||
{
|
||||
Case: "DoubleUp 250",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":250,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"DoubleUp","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 250↑↑",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 250↑↑",
|
||||
ExpectedEnabled: true,
|
||||
},
|
||||
{
|
||||
Case: "SingleUp 130",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":130,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"SingleUp","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 130↑",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 130↑",
|
||||
ExpectedEnabled: true,
|
||||
},
|
||||
{
|
||||
Case: "FortyFiveUp 174",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":174,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"FortyFiveUp","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 174↗",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 174↗",
|
||||
ExpectedEnabled: true,
|
||||
},
|
||||
{
|
||||
Case: "FortyFiveDown 61",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":61,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"FortyFiveDown","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 61↘",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 61↘",
|
||||
ExpectedEnabled: true,
|
||||
},
|
||||
{
|
||||
Case: "DoubleDown 50",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":50,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"DoubleDown","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 50↓↓",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 50↓↓",
|
||||
ExpectedEnabled: true,
|
||||
},
|
||||
{
|
||||
|
@ -96,8 +96,8 @@ func TestNSSegment(t *testing.T) {
|
|||
Case: "DoubleDown 50 from cache",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":50,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"DoubleDown","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 50↓↓",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 50↓↓",
|
||||
ExpectedEnabled: true,
|
||||
CacheTimeout: 10,
|
||||
},
|
||||
|
@ -105,8 +105,8 @@ func TestNSSegment(t *testing.T) {
|
|||
Case: "DoubleDown 50 from cache not found",
|
||||
JSONResponse: `
|
||||
[{"_id":"619d6fa819696e8ded5b2206","sgv":50,"date":1637707537000,"dateString":"2021-11-23T22:45:37.000Z","trend":4,"direction":"DoubleDown","device":"share2","type":"sgv","utcOffset":0,"sysTime":"2021-11-23T22:45:37.000Z","mills":1637707537000}]`, // nolint:lll
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 50↓↓",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 50↓↓",
|
||||
ExpectedEnabled: true,
|
||||
CacheTimeout: 10,
|
||||
CacheFoundFail: true,
|
||||
|
@ -115,8 +115,8 @@ func TestNSSegment(t *testing.T) {
|
|||
Case: "Error parsing response",
|
||||
JSONResponse: `
|
||||
4tffgt4e4567`,
|
||||
Template: " {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: " 50↓↓",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.TrendIcon}}",
|
||||
ExpectedString: "\ue2a1 50↓↓",
|
||||
ExpectedEnabled: false,
|
||||
CacheTimeout: 10,
|
||||
},
|
||||
|
@ -124,7 +124,7 @@ func TestNSSegment(t *testing.T) {
|
|||
Case: "Faulty template",
|
||||
JSONResponse: `
|
||||
[{"sgv":50,"direction":"DoubleDown"}]`,
|
||||
Template: " {{.Sgv}}{{.Burp}}",
|
||||
Template: "\ue2a1 {{.Sgv}}{{.Burp}}",
|
||||
ExpectedString: template.IncorrectTemplate,
|
||||
ExpectedEnabled: true,
|
||||
CacheTimeout: 10,
|
||||
|
|
|
@ -11,6 +11,7 @@ type Time struct {
|
|||
env environment.Environment
|
||||
|
||||
CurrentDate time.Time
|
||||
Format string
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -19,11 +20,12 @@ const (
|
|||
)
|
||||
|
||||
func (t *Time) Template() string {
|
||||
return "{{ .CurrentDate | date \"" + t.props.GetString(TimeFormat, "15:04:05") + "\" }}"
|
||||
return "{{ .CurrentDate | date .Format }}"
|
||||
}
|
||||
|
||||
func (t *Time) Enabled() bool {
|
||||
// if no date set, use now(unit testing)
|
||||
t.Format = t.props.GetString(TimeFormat, "15:04:05")
|
||||
if t.CurrentDate.IsZero() {
|
||||
t.CurrentDate = time.Now()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue