diff options
| author | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-05-25 09:08:11 +0100 |
|---|---|---|
| committer | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-05-25 09:08:11 +0100 |
| commit | 9404d187f2d645435fbbbe35982e488851f83ee8 (patch) | |
| tree | 5d3f51deb8e177d353deedeea4206af002aed1a6 /scripts | |
| parent | 481378543fb0601062726b54d141b0687d579eaa (diff) | |
| download | monorepo-9404d187f2d645435fbbbe35982e488851f83ee8.tar monorepo-9404d187f2d645435fbbbe35982e488851f83ee8.tar.gz monorepo-9404d187f2d645435fbbbe35982e488851f83ee8.tar.bz2 monorepo-9404d187f2d645435fbbbe35982e488851f83ee8.tar.xz monorepo-9404d187f2d645435fbbbe35982e488851f83ee8.zip | |
add old content
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/powershell/Get-GitDirty.ps1 | 19 | ||||
| -rw-r--r-- | scripts/powershell/Show-GitStatus.ps1 | 27 |
2 files changed, 46 insertions, 0 deletions
diff --git a/scripts/powershell/Get-GitDirty.ps1 b/scripts/powershell/Get-GitDirty.ps1 new file mode 100644 index 0000000..9216ef2 --- /dev/null +++ b/scripts/powershell/Get-GitDirty.ps1 @@ -0,0 +1,19 @@ +<# +.SYNOPSIS + Lists immediate subdirectories containing git repositories with pending changes. + +.DESCRIPTION + This script scans all depth-1 directories in the current location. + It filters for valid git repositories and checks if 'git status' returns any output. + Only the names of repositories with uncommitted changes (dirty) are returned. + +.EXAMPLE + PS C:\MyProjects> Get-GitDirty + + Returns a list of folder names that have pending changes. +#> + +Get-ChildItem -Directory | +Where-Object { Test-Path "$($_.FullName)\.git" } | +Where-Object { git -C $_.FullName status --porcelain } | +Select-Object Name
\ No newline at end of file diff --git a/scripts/powershell/Show-GitStatus.ps1 b/scripts/powershell/Show-GitStatus.ps1 new file mode 100644 index 0000000..e8b9548 --- /dev/null +++ b/scripts/powershell/Show-GitStatus.ps1 @@ -0,0 +1,27 @@ +<# +.SYNOPSIS + Displays a color-coded status report for all git repositories in immediate subdirectories. + +.DESCRIPTION + Iterates through all depth-1 directories. If a directory is a git repository, + it checks the status and prints the folder name to the host. + - Prints "[CLEAN]" in Green if there are no pending changes. + - Prints "[DIRTY]" in Red if there are uncommitted changes. + +.EXAMPLE + PS C:\MyProjects> Show-GitStatus + + repo-api [CLEAN] + repo-ui [DIRTY] +#> + +Get-ChildItem -Directory | +Where-Object { Test-Path "$($_.FullName)\.git" } | +ForEach-Object { + if (git -C $_.FullName status --porcelain) { + Write-Host "$($_.Name) [DIRTY]" -ForegroundColor Red + } + else { + Write-Host "$($_.Name) [CLEAN]" -ForegroundColor Green + } +}
\ No newline at end of file |
