X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/blobdiff_plain/56611982b910b5a645aa4ee7de7c784edd34f68e..cbe93fefb0223800e27ac4ef6b8c00a3cfbb0e4b:/psmodules/dash.psm1 diff --git a/psmodules/dash.psm1 b/psmodules/dash.psm1 index 88cd721..291127f 100644 --- a/psmodules/dash.psm1 +++ b/psmodules/dash.psm1 @@ -1,18 +1,135 @@ +function Get-JournalAgenda() { + agenda.exe -path "$HOME/Journal/{YYYY}/{MM}-{DD}.md" +} + +function Measure-JournalTodos() { + $todocount = todolist | Measure-Object -Line + if(Test-Path $env:todohist) { + $env:todocount = Get-Content -Path $env:todohist + } + $env:todocount += '|' + $env:todocount += $todocount.lines + $env:todocount | Out-File -Path $env:todohist +} + + +<# + +.EXAMPLE + +Show-GitRevList -From 2023.01.01 + +#> +function Show-GitRevList() { + param( + [string]$from + ) + Invoke-AgileCmd "git rev-list HEAD --count --since=$from" +} + +Export-ModuleMember -Function Show-GitRevList + + + +<# + +.SYNOPSIS + +Show a text dashboard. + +.EXAMPLE + +Include `Todo` list. +Show-MyDashboard -todo + +#> +function Show-MyDashBoard() { + param( + # [switch]$todocount=$true, + # [switch]$agenda, + [switch]$blocked, + [switch]$bugs, + [switch]$gitHub, + [switch]$help, + [switch]$leeroy, + [switch]$orphans, + [switch]$pr, + [switch]$requested, + [switch]$todo + ) + $todocount = $true + if($todocount){ + Measure-JournalTodos + Write-Host "" + Write-Host "## Todo items for today: $env:todocount" + chart -var todocount + } + $agenda = $true + if($agenda){ + Write-Host "" + Write-Host "## Agenda for today:" + Get-JournalAgenda + } + if($blocked){ + Write-Host "" + Write-Host "## Blocked & Blocker Issues:" + $blockerQuery = "label:blocker,blight,bug,blocked" + Invoke-AgileCmd "gh issue list -S '$blockerQuery'" + Write-Host "" + Write-Host "## Open Questions" + $questionQuery = 'label:"phone a friend",question,"needs context"' + Invoke-AgileCmd "gh issue list -S '$questionQuery'" + + } + if($bugs) { + Write-Host "" + Write-Host "## Known Bugs" + Invoke-AgileCmd "gh issue list -S 'label:bug'" + } + if($github) { + Write-Host "" + Write-Host "## GitHub Status (gh status)" + Invoke-Expression "gh status" + } + if($help) { + Write-Host "## Dasbhoard Help" + Get-Help Show-MyDashboard + } + if($leeroy){ + Write-Host "" + Write-Host "## Leeroy Jenkins!:" + Invoke-AgileCmd "gh issue list -l 'leeroy jenkins'" + } + if($orphans) { + Write-Host "" + Write-Host "## Issues with No Milestone" + Invoke-AgileCmd "gh issue list -S 'is:open is:issue no:milestone'" + } + if($pr) { + Write-Host "" + Write-Host "## Open Pull Requests" + Invoke-AgileCmd "gh pr list" + } + if($requested){ + Write-Host "" + Write-Host "## Open Stakeholder Requests" + invoke-agilecmd "gh issue list -S 'label:requested'" + } + if($todo) { + Write-Host "" + Write-Host "## Journal Todo Items" + todolist + Write-Host "" + Write-Host "## Todo.txt File" + todotxt + } +} -function Get-MyDashBoard() { - Write-Host "## Todo items for today:" - Measure-JournalTodos - chart - Get-JournalTodayTodos - Write-Host "## Agenda for today:" - Get-JournalAgenda - Write-Host "## GitHub Issues Assigned (Show-AgileMine)" - Show-AgileMine -DaysAgo 6 - Write-Host "## GitHub Issues with no milestone. (Show-AgileNoMilestone)" - Get-AgileNoMilestone -repository SecOps-Tools | Measure-Object -Property updated_at -Min -Max - Write-Host "Use command 'todo' to list more tasks." - Write-Host "Use command 'chart' to show todo item progress." - Write-Host "Use command 'agenda' to list the plan for today." +function Write-AgileClosedData() { + $gh_cmd = 'gh issue list --state closed --json title,closedAt,milestone,url' + Write-AgileToFile -gh_command $gh_cmd } -Export-ModuleMember -Function Get-MyDashboard \ No newline at end of file +Export-ModuleMember -Function Write-AgileClosedData +Export-ModuleMember -Function Show-MyDashboard +Export-ModuleMember -Function Show-MyTeamWork \ No newline at end of file