-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: create method for prettifying semantic versions
- Loading branch information
1 parent
e7bbcec
commit a325ade
Showing
4 changed files
with
42 additions
and
16 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
24 changes: 24 additions & 0 deletions
24
Sources/Utilities/Extensions/Built-in/SemanticVersion.swift
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,24 @@ | ||
// | ||
// SemanticVersion.swift | ||
// Mythic | ||
// | ||
// Created by Esiayo Alegbe on 11/12/24. | ||
// | ||
|
||
import SemanticVersion | ||
|
||
extension SemanticVersion { | ||
var prettyString: String { | ||
var versionString = "\(major).\(minor).\(patch)" | ||
|
||
if !preRelease.isEmpty { | ||
versionString += "-\(preRelease)" | ||
} | ||
|
||
if !build.isEmpty { | ||
versionString += " (\(build))" | ||
} | ||
|
||
return versionString | ||
} | ||
} |
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