diff --git a/ugit.types.ps1xml b/ugit.types.ps1xml index 76b1118..20c2200 100644 --- a/ugit.types.ps1xml +++ b/ugit.types.ps1xml @@ -324,6 +324,29 @@ if ($pushed) { [Regex]::new("#(?<n>\d+)").Matches($this.CommitMessage) -replace '#' -as [int[]] + + Scope + + <# +.SYNOPSIS + Gets the scope of a conventional commit +.DESCRIPTION + Gets the scope of a conventional commit, based on the commit message. +.LINK + https://www.conventionalcommits.org/en/v1.0.0/#summary +#> +if ($this.CommitMessage -match '^(?<Type>[^\r\n]+?):\s{0,}(?<Message>[^\r\n]+)') { + $matchType = $Matches.Type + if ($matchType -match '\(') { + $matchType -replace '.+?\(' -replace '\)\s{0,}$' + } else { + return '' + } +} else { + return '' +} + +