mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-23 08:26:49 +01:00
feat: add more scripts
This commit is contained in:
parent
cd289da742
commit
575db8e773
7 changed files with 99 additions and 9 deletions
21
modules/scripts/kctx.bash
Normal file
21
modules/scripts/kctx.bash
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if ! command -v kubectl &> /dev/null; then
|
||||
echo "kubectl not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONTEXTS=$(kubectl config get-contexts -o name)
|
||||
|
||||
if [ -z "$CONTEXTS" ]; then
|
||||
echo "No kubernetes contexts found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SELECTED=$(echo "$CONTEXTS" | fzf --prompt="Kube Context > " --height=20% --layout=reverse)
|
||||
|
||||
if [ -n "$SELECTED" ]; then
|
||||
kubectl config use-context "$SELECTED"
|
||||
echo "Switched to context: $SELECTED"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue