-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsit-issue.ps1
32 lines (32 loc) · 963 Bytes
/
sit-issue.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$cli = Get-Content -Raw -Path "$scriptPath\sit-issue.yaml"
$output = ($cli | & $Env:SIT args -- "sit issue" $args) -split '\n'
$command = $output[0]
$matched = $output[1..($output.Length - 1)]
switch -Regex ($command) {
'^list'
{
$query = & $Env:SIT config -q "'issue-tracking'.cli.oneliner || 'join(\' | \', [id, summary])'" repository
& $Env:SIT items -q $query
}
'^show' {
switch -Regex ($matched) {
'^ID\s+\d+\s+\d+\s(.+)' {
$ID = Invoke-Expression $Matches[1]
Write-Host -NoNewline "Summary: "
& $Env:SIT reduce -q summary $ID
Write-Host Details:
Write-Host
& $Env:SIT reduce -q details $ID
Write-Host
Write-Host Created at
& $Env:SIT reduce -q timestamp $ID
Write-Host by
& $Env:SIT reduce -q authors $ID
}
}
}
default {
$cli | & $Env:SIT args --help
}
}