Skip to content

Commit 6f4217c

Browse files
Merge pull request #74 from StartAutomating/ugitRemoving
Ugit removing
2 parents 06c233c + ebd74af commit 6f4217c

File tree

11 files changed

+118
-3
lines changed

11 files changed

+118
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.8:
2+
* Adding support for git rm (Fixes #73)
3+
---
4+
15
## 0.2.7:
26
* Adding support for git mv (#70, thanks @ninmonkey !)
37
---
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<#
2+
.Synopsis
3+
Git Remove Extension
4+
.Description
5+
Outputs git rm as objects.
6+
.EXAMPLE
7+
git rm .\FileIDontCareAbout.txt
8+
#>
9+
[Management.Automation.Cmdlet("Out","Git")] # It's an extension for Out-Git
10+
[ValidatePattern("^git rm")] # that is run when the switch -o is used.
11+
[OutputType([IO.FileInfo])]
12+
param( )
13+
14+
begin {
15+
$removeLines = @()
16+
}
17+
18+
process {
19+
$removeLines += $gitOut
20+
}
21+
22+
end {
23+
if ($gitArgument -match '--(?>n|dry-run)') {
24+
return $removeLines
25+
}
26+
27+
foreach ($line in $removeLines) {
28+
if ($line -match "^rm '") {
29+
$removedFileName = $line -replace "^rm\s" -replace "^'" -replace "'$"
30+
$removedLinesFound = $true
31+
[PSCustomObject][Ordered]@{
32+
PSTypeName = 'git.removal'
33+
RemovedFile = $removedFileName
34+
GitOutputLines = $removeLines
35+
GitRoot = $gitRoot
36+
GitCommand = $gitCommand
37+
}
38+
} else {
39+
$line
40+
}
41+
}
42+
}

Formatting/Git.Removal.format.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Write-FormatView -TypeName git.removal -GroupByProperty GitRoot -Property RemovedFile
2+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Get-UGitExtension is built using [Piecemeal](https://github.com/StartAutomating/
7171
* git pull
7272
* git push
7373
* git reflog
74+
* git rm
7475
* git shortlog
7576
* git status
7677
* git stash

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.8:
2+
* Adding support for git rm (Fixes #73)
3+
---
4+
15
## 0.2.7:
26
* Adding support for git mv (#70, thanks @ninmonkey !)
37
---

docs/Git.Rm-Extension.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Extensions/Git.Rm.UGit.Extension.ps1
3+
------------------------------------
4+
### Synopsis
5+
Git Remove Extension
6+
7+
---
8+
### Description
9+
10+
Outputs git rm as objects.
11+
12+
---
13+
### Examples
14+
#### EXAMPLE 1
15+
```PowerShell
16+
git rm .\FileIDontCareAbout.txt
17+
```
18+
19+
---
20+
### Outputs
21+
System.IO.FileInfo
22+
23+
24+
---
25+
### Syntax
26+
```PowerShell
27+
Extensions/Git.Rm.UGit.Extension.ps1 [<CommonParameters>]
28+
```
29+
---
30+
31+

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Get-UGitExtension is built using [Piecemeal](https://github.com/StartAutomating/
7171
* git pull
7272
* git push
7373
* git reflog
74+
* git rm
7475
* git shortlog
7576
* git status
7677
* git stash

ugit.ezout.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ $destinationRoot = $myRoot
1919
if ($formatting) {
2020
$myFormatFile = Join-Path $destinationRoot "$myModuleName.format.ps1xml"
2121
$formatting | Out-FormatData -Module $MyModuleName | Set-Content $myFormatFile -Encoding UTF8
22+
Get-Item $myFormatFile
2223
}
2324

2425
$types = @(
@@ -33,5 +34,6 @@ $types = @(
3334
if ($types) {
3435
$myTypesFile = Join-Path $destinationRoot "$myModuleName.types.ps1xml"
3536
$types | Out-TypeData | Set-Content $myTypesFile -Encoding UTF8
37+
Get-Item $myTypesFile
3638
}
3739
Pop-Location

ugit.format.ps1xml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-16"?>
2-
<!-- Generated with EZOut 1.8.6: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
2+
<!-- Generated with EZOut 1.9.0: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
33
<Configuration>
44
<Controls>
55
<Control>
@@ -1726,6 +1726,30 @@ $BackgroundColor
17261726
</TableRowEntries>
17271727
</TableControl>
17281728
</View>
1729+
<View>
1730+
<Name>git.removal</Name>
1731+
<ViewSelectedBy>
1732+
<TypeName>git.removal</TypeName>
1733+
</ViewSelectedBy>
1734+
<GroupBy>
1735+
<PropertyName>GitRoot</PropertyName>
1736+
</GroupBy>
1737+
<TableControl>
1738+
<TableHeaders>
1739+
<TableColumnHeader>
1740+
</TableColumnHeader>
1741+
</TableHeaders>
1742+
<TableRowEntries>
1743+
<TableRowEntry>
1744+
<TableColumnItems>
1745+
<TableColumnItem>
1746+
<PropertyName>RemovedFile</PropertyName>
1747+
</TableColumnItem>
1748+
</TableColumnItems>
1749+
</TableRowEntry>
1750+
</TableRowEntries>
1751+
</TableControl>
1752+
</View>
17291753
<View>
17301754
<Name>Git.Shortlog</Name>
17311755
<ViewSelectedBy>

ugit.psd1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ModuleVersion = '0.2.7'
2+
ModuleVersion = '0.2.8'
33
RootModule = 'ugit.psm1'
44
FormatsToProcess = 'ugit.format.ps1xml'
55
TypesToProcess = 'ugit.types.ps1xml'
@@ -16,6 +16,10 @@ PrivateData = @{
1616
ProjectURI = 'https://github.com/StartAutomating/ugit'
1717
LicenseURI = 'https://github.com/StartAutomating/ugit/blob/main/LICENSE'
1818
ReleaseNotes = @'
19+
## 0.2.8:
20+
* Adding support for git rm (Fixes #73)
21+
---
22+
1923
## 0.2.7:
2024
* Adding support for git mv (#70, thanks @ninmonkey !)
2125
---

0 commit comments

Comments
 (0)