You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: A builtin Powershell version of SemVer exists in 'System.Management.Automation'. At this time, it does not parsing of PrereleaseNumber. It's name is also type accelerated to 'SemVer'.
14
14
#>
15
15
16
-
classAzureEngSemanticVersion {
16
+
classAzureEngSemanticVersion: IComparable {
17
17
[int] $Major
18
18
[int] $Minor
19
19
[int] $Patch
@@ -178,6 +178,31 @@ class AzureEngSemanticVersion {
178
178
$this.DefaultAlphaReleaseLabel="alpha"
179
179
}
180
180
181
+
[int] CompareTo($other)
182
+
{
183
+
if ($other-isnot [AzureEngSemanticVersion]) {
184
+
throw"Cannot compare $other with $this"
185
+
}
186
+
187
+
$ret=$this.Major.CompareTo($other.Major)
188
+
if ($ret) { return$ret }
189
+
190
+
$ret=$this.Minor.CompareTo($other.Minor)
191
+
if ($ret) { return$ret }
192
+
193
+
$ret=$this.Patch.CompareTo($other.Patch)
194
+
if ($ret) { return$ret }
195
+
196
+
# Mimic PowerShell that uses case-insensitive comparisons by default.
0 commit comments