I hereby claim:
- I am jdharmon on github.
- I am jdharmon (https://keybase.io/jdharmon) on keybase.
- I have a public key ASBIYp-yt0-x9vJQnTTbLnqCkNJFcQqyv5jBoCzvG1_IZwo
To claim this, I am signing this object:
| # Colors | |
| local RED="%F{red}" | |
| local GREEN="%F{green}" | |
| local BLUE="%F{blue}" | |
| local YELLOW="%F{yellow}" | |
| local MAGENTA="%F{magenta}" | |
| local CYAN="%F{cyan}" | |
| local RESET="%f" | |
| # Symbols |
| # Add to PowerShell $PROFILE | |
| function Get-GitPrompt { | |
| $inGitRepo = [bool](git rev-parse --is-inside-work-tree 2>$null) | |
| if (-not $inGitRepo) { | |
| return | |
| } | |
| $branch = git branch --show-current | |
| $status = git status --short --branch |
| function Set-WorkingDirectory($Path) { | |
| if (-not $Path) { | |
| $Path = "~" | |
| } | |
| if ((Resolve-Path $Path).Provider.Name -eq 'FileSystem') { | |
| [System.IO.Directory]::SetCurrentDirectory($Path) | |
| } | |
| Set-Location $Path | |
| } |
| private static void WaitForExitSignal() | |
| { | |
| using (var signal = new ManualResetEventSlim()) | |
| { | |
| // Handle SIGTERM | |
| AssemblyLoadContext.Default.Unloading += _ => signal.Set(); | |
| // Hadle SIGINT/Ctrl+C | |
| Console.CancelKeyPress += (s, a) => | |
| { |
| using Microsoft.Extensions.Configuration; | |
| using Microsoft.Extensions.DependencyInjection; | |
| using Microsoft.Extensions.Logging; | |
| using System; | |
| using System.IO; | |
| using System.Runtime.Loader; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| namespace MyApp |
| # Setup | |
| Install-Module -Name PSBashCompletions -Scope CurrentUser | |
| $path = (mkdir (Join-Path (Split-Path -Parent $PROFILE) Completion)).FullName | |
| ((kubectl completion bash) -join "`n") | Set-Content -Encoding ASCII -NoNewline -Path $path/kubectl.sh | |
| ((helm completion bash) -join "`n") | Set-Content -Encoding ASCII -NoNewline -Path $path/helm.sh | |
| # Profile | |
| $completionPath = Join-Path (Split-Path -Parent $PROFILE) Completion | |
| if (Test-Path $completionPath) { | |
| Import-Module PSBashCompletions |
| function Watch-Command { | |
| [CmdletBinding()] | |
| Param( | |
| [Parameter(ValueFromPipeline, Mandatory)] | |
| [object] | |
| $ScriptBlock, | |
| [int] | |
| $Seconds = 2 | |
| ) |
| function Join-Url([string[]]$parts) { | |
| return ($parts | % { $_.Trim('/') } | ? { $_ }) -join '/' | |
| } |
I hereby claim:
To claim this, I am signing this object: