diff --git a/docs/docs/segment-angular.md b/docs/docs/segment-angular.md index b7ff7d85..c3072398 100644 --- a/docs/docs/segment-angular.md +++ b/docs/docs/segment-angular.md @@ -29,3 +29,17 @@ Display the currently active Angular CLI version. - display_mode: `string` - determines when the segment is displayed - `always`: the segment is always displayed - `files`: the segment is only displayed when `angular.json` file is present (default) +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-azfunc.md b/docs/docs/segment-azfunc.md index 6b4368ae..984c0fb4 100644 --- a/docs/docs/segment-azfunc.md +++ b/docs/docs/segment-azfunc.md @@ -33,3 +33,17 @@ Display the currently active Azure functions CLI version. - display_mode: `string` - determines when the segment is displayed - `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: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-crystal.md b/docs/docs/segment-crystal.md index 9cf8ead6..8f995bc8 100644 --- a/docs/docs/segment-crystal.md +++ b/docs/docs/segment-crystal.md @@ -32,3 +32,17 @@ Display the currently active crystal version. - display_mode: `string` - determines when the segment is displayed - `always`: the segment is always displayed - `files`: the segment is only displayed when `*.cr` or `shard.yml` files are present (default) +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the + 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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-dart.md b/docs/docs/segment-dart.md index ddfe2475..9eb1d0e7 100644 --- a/docs/docs/segment-dart.md +++ b/docs/docs/segment-dart.md @@ -33,3 +33,17 @@ Display the currently active dart version. - `always`: the segment is always displayed - `files`: the segment is only displayed when `*.dart`, `pubspec.yaml`, `pubspec.yml`, `pubspec.lock` files or the `.dart_tool` folder are present (default) +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-dotnet.md b/docs/docs/segment-dotnet.md index a8300c14..83bb0c20 100644 --- a/docs/docs/segment-dotnet.md +++ b/docs/docs/segment-dotnet.md @@ -37,12 +37,13 @@ Display the currently active .NET SDK version. - unsupported_version_icon: `string` - text/icon that is displayed when the active .NET SDK version (e.g., one specified by `global.json`) is not installed/supported - defaults to `\uf071` (X in a rectangle box) - template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the -properties below. Defaults does nothing(backward compatibility). +properties below. Defaults to `{{ .Full }}` - version_url_template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the properties below. Defaults does nothing(backward compatibility). ## 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 diff --git a/docs/docs/segment-golang.md b/docs/docs/segment-golang.md index 10321d3f..7790269c 100644 --- a/docs/docs/segment-golang.md +++ b/docs/docs/segment-golang.md @@ -32,3 +32,14 @@ Display the currently active golang version. - display_mode: `string` - determines when the segment is displayed - `always`: the segment is always displayed - `files`: the segment is only displayed when `*.go` or `go.mod` files are present (default) +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 diff --git a/docs/docs/segment-java.md b/docs/docs/segment-java.md index f4cc85dd..c13c3e0c 100644 --- a/docs/docs/segment-java.md +++ b/docs/docs/segment-java.md @@ -45,3 +45,14 @@ Display the currently active java version. - `*.jar` - `*.clj` - `*.cljc` +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 diff --git a/docs/docs/segment-julia.md b/docs/docs/segment-julia.md index 4b756083..3a4a0ecc 100644 --- a/docs/docs/segment-julia.md +++ b/docs/docs/segment-julia.md @@ -32,3 +32,17 @@ Display the currently active julia version. - display_mode: `string` - determines when the segment is displayed - `always`: the segment is always displayed - `files`: the segment is only displayed when `*.jl` files are present (default) +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-node.md b/docs/docs/segment-node.md index 04d5963a..ced7d23e 100644 --- a/docs/docs/segment-node.md +++ b/docs/docs/segment-node.md @@ -40,3 +40,17 @@ segment's background or foreground color - display_package_manager: `boolean` - show whether the current project uses Yarn or NPM - defaults to `false` - 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: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-php.md b/docs/docs/segment-php.md index a7b05aa2..47b8ea48 100644 --- a/docs/docs/segment-php.md +++ b/docs/docs/segment-php.md @@ -34,3 +34,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) - enable_hyperlink: `bool` - display an hyperlink to the php release notes - defaults to `false` +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-python.md b/docs/docs/segment-python.md index 80fa7187..13bd1f81 100644 --- a/docs/docs/segment-python.md +++ b/docs/docs/segment-python.md @@ -39,3 +39,17 @@ or not - defaults to `true` files are present (default) - `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: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-ruby.md b/docs/docs/segment-ruby.md index e64fcf71..5d812f68 100644 --- a/docs/docs/segment-ruby.md +++ b/docs/docs/segment-ruby.md @@ -32,3 +32,17 @@ Display the currently active ruby version. - display_mode: `string` - determines when the segment is displayed - `always`: the segment is always displayed - `files`: the segment is only displayed when `*.rb`, `Gemfile` or `Rakefile` files are present (default) +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/docs/segment-rust.md b/docs/docs/segment-rust.md index 30c222df..c0f2a431 100644 --- a/docs/docs/segment-rust.md +++ b/docs/docs/segment-rust.md @@ -32,3 +32,17 @@ Display the currently active rust version. - display_mode: `string` - determines when the segment is displayed - `always`: the segment is always displayed - `files`: the segment is only displayed when `*.rs`, `Cargo.toml` or `Cargo.lock` files are present (default) +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +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 + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/src/segment_language.go b/src/segment_language.go index d9ced7b2..2cfffa89 100644 --- a/src/segment_language.go +++ b/src/segment_language.go @@ -97,7 +97,7 @@ func (l *language) string() string { return "" } - segmentTemplate := l.props.getString(SegmentTemplate, "{{.Full}}") + segmentTemplate := l.props.getString(SegmentTemplate, "{{ .Full }}") template := &textTemplate{ Template: segmentTemplate, Context: l.version,