Last active
November 3, 2018 10:50
-
-
Save lydemann/b6928730f5a548ac46f686bdb43753b4 to your computer and use it in GitHub Desktop.
get-branch-without-prefix
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
param( | |
[string]$branch = "master" | |
) | |
$prefix, $name = $branch.Split("/"); | |
Write-Host "Found prefix: $prefix, and name: $name"; | |
if ([string]::IsNullOrEmpty($prefix) -and [string]::IsNullOrEmpty($name)) { | |
exit(-1); | |
} | |
if (-not [string]::IsNullOrEmpty($name)) { | |
Write-Output $name | |
exit(0); | |
} | |
if (-not [string]::IsNullOrEmpty($prefix)) { | |
Write-Output $prefix | |
exit(0); | |
} | |
exit(-1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment