mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
feat(language): add error text to template properties
This commit is contained in:
parent
e866c6bf76
commit
f495a7093a
|
@ -35,11 +35,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -39,11 +39,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -38,11 +38,12 @@ Display the currently active crystal version.
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -39,11 +39,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -44,11 +44,12 @@ with [sprig][sprig] utilizing the properties below. Defaults does nothing(backwa
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -38,8 +38,9 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
|
|
@ -51,8 +51,9 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
|
|
@ -38,11 +38,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -46,11 +46,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -40,11 +40,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -46,11 +46,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
|
||||
- `.Venv`: `string` - the virtual environment name (if present)
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -38,11 +38,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -38,11 +38,12 @@ properties below. Defaults to `{{ .Full }}`
|
|||
## Template Properties
|
||||
|
||||
- `.Full`: `string` - the full version
|
||||
- `.Major`: `string` - is the major version
|
||||
- `.Minor`: `string` - is the minor version
|
||||
- `.Patch`: `string` - is the patch version
|
||||
- `.Prerelease`: `string` - is the prerelease version
|
||||
- `.BuildMetadata`: `string` - is the build metadata
|
||||
- `.Major`: `string` - major number
|
||||
- `.Minor`: `string` - minor number
|
||||
- `.Patch`: `string` - patch number
|
||||
- `.Prerelease`: `string` - prerelease info text
|
||||
- `.BuildMetadata`: `string` - build metadata
|
||||
- `.Error`: `string` - when fetching the version string errors
|
||||
|
||||
[go-text-template]: https://golang.org/pkg/text/template/
|
||||
[sprig]: https://masterminds.github.io/sprig/
|
||||
|
|
|
@ -58,6 +58,7 @@ type language struct {
|
|||
displayMode string
|
||||
|
||||
version
|
||||
Error string
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -89,6 +90,7 @@ func (l *language) string() string {
|
|||
}
|
||||
|
||||
err := l.setVersion()
|
||||
l.Error = err.Error()
|
||||
displayError := l.props.getBool(DisplayError, true)
|
||||
if err != nil && displayError {
|
||||
return err.Error()
|
||||
|
|
Loading…
Reference in a new issue