mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-27 23:26:32 +01:00
Improved the script
This commit is contained in:
parent
ab6a0ce13f
commit
f03aea3557
@ -1,12 +1,12 @@
|
|||||||
#!/bin/powershell
|
#!/bin/powershell
|
||||||
<#
|
<#
|
||||||
.SYNTAX ./list-branches.ps1 [<repo-dir>]
|
.SYNTAX ./list-branches.ps1 [<repo-dir>] [<pattern>]
|
||||||
.DESCRIPTION lists the branches of the current/given Git repository
|
.DESCRIPTION lists the branches of the current/given Git repository
|
||||||
.LINK https://github.com/fleschutz/PowerShell
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD")
|
param($RepoDir = "$PWD", $Pattern = "*")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$null = $(git --version)
|
$null = $(git --version)
|
||||||
@ -17,8 +17,9 @@ try {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
set-location $RepoDir
|
set-location $RepoDir
|
||||||
& git branch --list --no-color --no-column
|
|
||||||
if ($lastExitCode -ne "0") { throw "'git branch' failed" }
|
& git branch --list "$Pattern" --no-color --no-column
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git branch --list' failed" }
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user