1919[Management.Automation.Cmdlet (" Use" , " Git" )]
2020[CmdletBinding (PositionalBinding = $false )]
2121param (
22+ # The number of entries to get.
23+ [Alias (' CommitNumber' , ' N' , ' Number' )]
24+ [int ]
25+ $NumberOfCommits ,
26+
2227# Gets logs after a given date
2328[DateTime ]
2429[Alias (' Since' )]
@@ -43,16 +48,47 @@ $CurrentBranch,
4348[Parameter (ValueFromPipelineByPropertyName )]
4449[Alias (' ReferenceNumbers' , ' ReferenceNumber' , ' IssueNumbers' , ' WorkItemID' , ' WorkItemIDs' )]
4550[int []]
46- $IssueNumber
51+ $IssueNumber ,
52+
53+ # If set, will get statistics associated with each change
54+ [Alias (' Stat' )]
55+ [switch ]
56+ $Statistics ,
57+
58+ # If provided, will search for specific strings within the change sets of a commit.
59+ # This is especially useful when finding references to or changes to a given function or structure.
60+ [Parameter (ValueFromPipelineByPropertyName )]
61+ [Alias (' Search' )]
62+ [string ]
63+ $SearchString ,
64+
65+ # If provided, will search for specific patterns within the change sets of a commit.
66+ # This is especially useful when finding references to or changes to a given function or structure.
67+ [Parameter (ValueFromPipelineByPropertyName )]
68+ [Alias (' Pattern' )]
69+ [string ]
70+ $SearchPattern
4771)
4872
73+ # If the number of commits was provided, it should come first.
74+ if ($NumberOfCommits ) {
75+ ' -n'
76+ " $NumberOfCommits "
77+ }
78+
4979foreach ($dashToDoubleDash in ' after' , ' before' , ' author' ) {
5080 if ($PSBoundParameters [$dashToDoubleDash ]) {
5181 " --$dashToDoubleDash "
5282 " $ ( $PSBoundParameters [$dashToDoubleDash ]) "
5383 }
5484}
5585
86+ foreach ($dashToDoubleDashSwitch in ' Statistics' ) {
87+ if ($PSBoundParameters [$dashToDoubleDash ]) {
88+ " --$dashToDoubleDashSwitch "
89+ }
90+ }
91+
5692if ($CurrentBranch ) {
5793 $headbranch = git remote | git remote show | Select-Object - ExpandProperty HeadBranch
5894 $currentBranchName = git branch | Where-Object IsCurrentBranch
@@ -72,6 +108,15 @@ if ($IssueNumber) {
72108 } else {
73109 " \#$IssueNum \D"
74110 }
75- }
76-
111+ }
112+ }
113+
114+ if ($SearchString ) {
115+ " -S"
116+ $SearchString
117+ }
118+
119+ if ($SearchPattern ) {
120+ " -G"
121+ $SearchPattern
77122}
0 commit comments