-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from StartAutomating/ugit-updates
ugit 0.3.8
- Loading branch information
Showing
41 changed files
with
1,009 additions
and
344 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<# | ||
.SYNOPSIS | ||
Git Clone extended input | ||
.DESCRIPTION | ||
Extends the input for git clone. | ||
By default, if --progress is not found, it will be added to any git clone. | ||
.EXAMPLE | ||
git clone https://github.com/MDN/content.git # This is a big repo. Progress bars will be very welcome. | ||
#> | ||
[ValidatePattern('^git clone')] | ||
[Management.Automation.Cmdlet("Use","Git")] | ||
[CmdletBinding(PositionalBinding=$false)] | ||
param( | ||
) | ||
|
||
if ($gitArgument -notcontains '--progress') { | ||
'--progress' | ||
} |
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,66 @@ | ||
<# | ||
.SYNOPSIS | ||
Git Commit Input | ||
.DESCRIPTION | ||
Makes Git Commit easier to use from PowerShell by providing parameters for the -Message, -Title, -Body, and -Trailers | ||
.EXAMPLE | ||
git commit -Title "Fixing Something" | ||
.EXAMPLE | ||
git commit -Title "Changing Stuff" -Trailers @{"Co-Authored-By"="SOMEONE ELSE <[email protected]>"} | ||
#> | ||
[ValidatePattern('^git commit')] | ||
[Management.Automation.Cmdlet('Use','Git')] | ||
[CmdletBinding(PositionalBinding=$false)] | ||
param( | ||
# The message used for the commit | ||
[string] | ||
$Message, | ||
|
||
# The title of the commit. If -Message is also provided, this will become part of the -Body | ||
[string] | ||
$Title, | ||
|
||
# The body of the commit. | ||
[string] | ||
$Body, | ||
|
||
# Any git trailers to add to the commit. | ||
# git trailers are key-value pairs you can use to associate metadata with a commit. | ||
# As this uses --trailer, this requires git version 2.33 or greater. | ||
[Alias('Trailer','CommitMetadata','GitMetadata')] | ||
[Collections.IDictionary] | ||
$Trailers, | ||
|
||
# If set, will amend an existing commit. | ||
[switch] | ||
$Amend | ||
) | ||
|
||
|
||
|
||
if ($Message) { | ||
"-m" | ||
$message | ||
} | ||
|
||
if ($Title) { | ||
"-m" | ||
$title | ||
} | ||
|
||
if ($Body) { | ||
"-m" | ||
$body | ||
} | ||
|
||
if ($Trailers) { | ||
foreach ($kv in $Trailers.GetEnumerator()) { | ||
foreach ($val in $kv.Value) { | ||
"--trailer=$($kv.Key -replace ':','_colon_' -replace '\s', '-')=$val" | ||
} | ||
} | ||
} | ||
|
||
if ($amend) { | ||
"--amend" | ||
} |
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,77 @@ | ||
<# | ||
.SYNOPSIS | ||
git log input | ||
.DESCRIPTION | ||
Extends the parameters for git log, making it easier to use from PowerShell. | ||
Allows timeframe parameters to be tab-completed: | ||
* After/Since become --after | ||
* Before/Until become --before | ||
* Author/Committer become --author | ||
Adds -CurrentBranch, which gives the changes between the upstream branch and the current branch. | ||
Also adds -IssueNumber, which searchers for commits that reference particular issues. | ||
.EXAMPLE | ||
git log -CurrentBranch | ||
#> | ||
[ValidatePattern('^git log')] | ||
[Management.Automation.Cmdlet("Use","Git")] | ||
[CmdletBinding(PositionalBinding=$false)] | ||
param( | ||
# Gets logs after a given date | ||
[DateTime] | ||
[Alias('Since')] | ||
$After, | ||
|
||
# Gets before a given date | ||
[DateTime] | ||
[Alias('Until')] | ||
$Before, | ||
|
||
# Gets lof from a given author or committer | ||
[Alias('Committer')] | ||
[string] | ||
$Author, | ||
|
||
# If set, will get all changes between the upstream branch and the current branch. | ||
[Alias('UpstreamDelta','ThisBranch')] | ||
[switch] | ||
$CurrentBranch, | ||
|
||
# One or more issue numbers. Providing an issue number of 0 will find all log entries that reference an issue. | ||
[Parameter(ValueFromPipelineByPropertyName)] | ||
[Alias('ReferenceNumbers','ReferenceNumber','IssueNumbers','WorkItemID','WorkItemIDs')] | ||
[int[]] | ||
$IssueNumber | ||
) | ||
|
||
foreach ($dashToDoubleDash in 'after', 'before', 'author') { | ||
if ($PSBoundParameters[$dashToDoubleDash]) { | ||
"--$dashToDoubleDash" | ||
"$($PSBoundParameters[$dashToDoubleDash])" | ||
} | ||
} | ||
|
||
if ($CurrentBranch) { | ||
$headbranch = git remote | git remote show | Select-Object -ExpandProperty HeadBranch | ||
$currentBranchName = git branch | Where-Object IsCurrentBranch | ||
if ($currentBranchName -ne $headbranch) { | ||
"$headbranch..$currentBranchName" | ||
} else { | ||
Write-Warning "On $headBranch" | ||
} | ||
} | ||
|
||
if ($IssueNumber) { | ||
"--perl-regexp" | ||
foreach ($IssueNum in $IssueNumber) { | ||
'--grep' | ||
if ($IssueNum -eq 0) { | ||
'\#\d+\D' | ||
} else { | ||
"\#$IssueNum\D" | ||
} | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.