111 lines
2.5 KiB
PowerShell
111 lines
2.5 KiB
PowerShell
oh-my-posh init pwsh --config "$HOME/.theme.omp.json" | Invoke-Expression
|
|
|
|
# git posh, seems to slow down things
|
|
# Import-Module posh-git
|
|
|
|
# setup fnm
|
|
fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expression
|
|
|
|
# Functions
|
|
function cdli {
|
|
Set-Location "C:\repos\litium"
|
|
}
|
|
|
|
function cdsf {
|
|
Set-Location "C:\repos\storefront"
|
|
}
|
|
|
|
function cdr {
|
|
Set-Location "C:\repos"
|
|
}
|
|
|
|
function proxy {
|
|
winget install caddy
|
|
& caddy 'C:\Users\ZackariasMontell\OneDrive - RevolutionRace\caddyfile'
|
|
}
|
|
|
|
function reset-card {
|
|
& "gpg-connect-agent" "killagent" "/bye"
|
|
& "gpg-connect-agent" "/bye"
|
|
& "gpg" "--card-status"
|
|
}
|
|
|
|
function card {
|
|
& "gpg" "--card-status"
|
|
}
|
|
|
|
function Open-KubernetesDashboard {
|
|
Write-Host "Ensuring doctl.."
|
|
if ($os -eq 'Unix') {
|
|
brew install doctl
|
|
}
|
|
else {
|
|
winget install DigitalOcean.Doctl
|
|
}
|
|
|
|
Write-Host "Checking your login status.."
|
|
$accountInfo = doctl account get
|
|
|
|
if ($null -eq $accountInfo) {
|
|
$token = Read-Host "You are not logged in, please enter your doctl token, you can create one here https://cloud.digitalocean.com/account/api/tokens"
|
|
doctl auth init -t $token
|
|
}
|
|
|
|
$cluster = Read-Host "What cluster do you want to connect to? staging or production (default: staging)"
|
|
|
|
if ($cluster -eq "production") {
|
|
$cluster = "production-cluster"
|
|
}
|
|
else {
|
|
$cluster = "staging-cluster"
|
|
}
|
|
|
|
Write-Host "Setting up kubectl context.."
|
|
doctl kubernetes cluster kubeconfig save $cluster
|
|
|
|
Write-Host "Generating token.."
|
|
$token = kubectl -n kubernetes-dashboard create token admin-user
|
|
Set-Clipboard -Value $token
|
|
Write-Host "Token copied to clipboard."
|
|
|
|
Write-Host "Opening Kubernetes dashboard.."
|
|
$url = "http://localhost:8080/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login"
|
|
|
|
Start-Process $url
|
|
|
|
Write-Host "Setting up port forwarding, close this when you are done.."
|
|
kubectl proxy --port 8080
|
|
}
|
|
|
|
function Open-Nuxt(){
|
|
cdsf
|
|
yarn
|
|
yarn dev
|
|
}
|
|
|
|
function Edit-Powershell(){
|
|
nvim $profile
|
|
. $profile
|
|
}
|
|
|
|
function Edit-Nvim(){
|
|
prev = (& pwd).Path
|
|
cd ~\AppData\Local\nvim
|
|
nvim .
|
|
cd prev
|
|
}
|
|
|
|
# Aliases
|
|
Set-alias -Name g -Value git
|
|
Set-Alias -Name k -Value kubectl
|
|
Set-Alias -Name d -Value docker
|
|
Set-Alias -Name do -Value doctl
|
|
Set-Alias -Name vim -Value nvim
|
|
Set-Alias -Name yy -Value Open-Nuxt
|
|
|
|
Set-Alias -Name dash -Value Open-KubernetesDashboard
|
|
|
|
Set-Alias -Name cd-repos -Value cdr
|
|
Set-Alias -Name cd-sf -Value cdsf
|
|
Set-Alias -Name cd-li -Value cdli
|