feat(fish): save installed plugins and update fish.config

This commit is contained in:
2025-08-13 09:01:57 +02:00
parent 44cae2d57b
commit dec5e209cb
4 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# Vervollständige Secret-Namen aus aktuellem oder gegebenem Namespace
function __ksecret_list_secrets
set -l ns (commandline -opc | grep -oE '\-n\s+\S+' | awk '{print $2}')
if test -n "$ns"
kubectl get secrets -n $ns -o json | jq -r '.items[].metadata.name'
else
kubectl get secrets -o json | jq -r '.items[].metadata.name'
end
end
# Vervollständige Namespace-Namen
function __ksecret_list_namespaces
kubectl get ns -o json | jq -r '.items[].metadata.name'
end
# Vervollständigung für secret-name (erstes Argument)
complete -c ksecret -n '__fish_use_subcommand' -a '(__ksecret_list_secrets)' -f -d "Secret name"
# Vervollständigung für -n (Namespace-Flag)
complete -c ksecret -s n -l namespace -x -a '(__ksecret_list_namespaces)' -d "Namespace"

View File

@@ -22,3 +22,15 @@ zoxide init fish | source
alias rm "trash -v" alias rm "trash -v"
alias ll "eza -l" alias ll "eza -l"
alias ls "eza" alias ls "eza"
for f in ~/.config/fish/functions/user/*.fish
source $f
end
for f in ~/.config/fish/completions/user/*.fish
source $f
end
# Enable starship
starship init fish | source

4
fish/fish_plugins Normal file
View File

@@ -0,0 +1,4 @@
jorgebucaran/fisher
patrickf1/fzf.fish
jorgebucaran/nvm.fish
jethrokuan/z

View File

@@ -0,0 +1,48 @@
function ksecret
set -l namespace ""
set -l secret_name ""
# Manuelles Argument-Parsen
while set -q argv[1]
switch $argv[1]
case -n
if not set -q argv[2]
echo "Error: Missing namespace after -n" >&2
return 1
end
set namespace $argv[2]
set argv $argv[3..-1]
case --help -h
echo "Usage: ksecret <secret-name> [-n <namespace>]"
return 0
case '*'
if test -z "$secret_name"
set secret_name $argv[1]
set argv $argv[2..-1]
else
echo "Error: Unknown argument $argv[1]" >&2
return 1
end
end
end
if test -z "$secret_name"
echo "Error: secret name is required" >&2
return 1
end
if test -n "$namespace"
if not kubectl get namespace "$namespace" > /dev/null 2>&1
echo "Error: Namespace '$namespace' does not exist" >&2
return 1
end
kubectl get secret $secret_name -n $namespace -o json | jq -r '
.data | to_entries[] | "\(.key): \(.value | @base64d)"
'
else
kubectl get secret $secret_name -o json | jq -r '
.data | to_entries[] | "\(.key): \(.value | @base64d)"
'
end
end