-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package main | ||
|
||
type nbgv struct { | ||
props *properties | ||
env environmentInfo | ||
Nbgv *VersionInfo | ||
} | ||
|
||
type VersionInfo struct { | ||
VersionFileFound bool `json:"VersionFileFound"` | ||
Version bool `json:"Version"` | ||
AssemblyVersion bool `json:"AssemblyVersion"` | ||
AssemblyInformationalVersion bool `json:"AssemblyInformationalVersion"` | ||
NuGetPackageVersion bool `json:"NuGetPackageVersion"` | ||
ChocolateyPackageVersion bool `json:"ChocolateyPackageVersion"` | ||
NpmPackageVersion bool `json:"NpmPackageVersion"` | ||
SimpleVersion bool `json:"SimpleVersion"` | ||
} | ||
|
||
func (n *nbgv) enabled() bool { | ||
return true | ||
} | ||
|
||
func (n *nbgv) string() string { | ||
segmentTemplate := n.props.getString(SegmentTemplate, "{{ .Nbgv.Version }}") | ||
template := &textTemplate{ | ||
Template: segmentTemplate, | ||
Context: n, | ||
Env: n.env, | ||
} | ||
text, err := template.render() | ||
if err != nil { | ||
return err.Error() | ||
} | ||
return text | ||
} | ||
|
||
func (n *nbgv) init(props *properties, env environmentInfo) { | ||
n.props = props | ||
n.env = env | ||
} |