Skip to content

Commit 5f0f058

Browse files
authored
🔀 Merge pull request #45 from mstred/master
2 parents 466070f + 032da3a commit 5f0f058

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

src/aliases.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,19 @@ function gpoat {
257257
git push origin --all
258258
git push origin --tags
259259
}
260+
function gpr {
261+
git pull --rebase $args
262+
}
263+
function gpra {
264+
git pull --rebase --autostash $args
265+
}
260266
function gpristine {
261267
git reset --hard
262268
git clean -dfx
263269
}
270+
function gprv {
271+
git pull --rebase -v $args
272+
}
264273
function gpu {
265274
git push upstream $args
266275
}
@@ -394,12 +403,15 @@ function gunwip {
394403
git reset HEAD~1
395404
}
396405
function gup {
406+
Write-Host-Deprecated "gup" "gpr"
397407
git pull --rebase $args
398408
}
399409
function gupa {
410+
Write-Host-Deprecated "gupa" "gpra"
400411
git pull --rebase --autostash $args
401412
}
402413
function gupv {
414+
Write-Host-Deprecated "gupv" "gprv"
403415
git pull --rebase -v $args
404416
}
405417
function glum {

src/git-aliases.psm1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ $FunctionsToExport = @(
7979
'gpf',
8080
'gpf!',
8181
'gpoat',
82+
'gpr',
83+
'gpra',
8284
'gpristine',
85+
'gprv',
8386
'gpu',
8487
'gpv',
8588
'gr',

src/utils.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,26 @@ function Get-Git-Aliases ([string] $Alias) {
133133

134134
return Format-Table -InputObject $aliases -AutoSize -Wrap -Property $cols
135135
}
136+
137+
<#
138+
.SYNOPSIS
139+
Print deprecated message.
140+
.DESCRIPTION
141+
Print a colored message telling that a specific alias ($previous)
142+
is deprecated, suggesting the use of another alias ($next).
143+
.EXAMPLE
144+
PS C:\> Write-Host-Deprecated "gup" "gpr"
145+
[git-aliases] gup is a deprecated alias, use "gpr" instead.
146+
#>
147+
function Write-Host-Deprecated {
148+
param (
149+
[Parameter(Mandatory = $true)][string] $previous,
150+
[Parameter(Mandatory = $true)][string] $next
151+
)
152+
153+
Write-Host "[git-aliases] " -ForegroundColor Yellow -NoNewLine
154+
Write-Host "${previous}" -ForegroundColor Red -NoNewLine
155+
Write-Host " is a deprecated alias, use " -ForegroundColor Yellow -NoNewLine
156+
Write-Host """${next}""" -ForegroundColor Green -NoNewLine
157+
Write-Host " instead.`n" -ForegroundColor Yellow
158+
}

0 commit comments

Comments
 (0)