From 188e601c2eb04f2a51f03b811a487e71c343fb76 Mon Sep 17 00:00:00 2001 From: "Mariano Z." Date: Mon, 29 Sep 2025 13:38:09 -0300 Subject: [PATCH] dev: automated commit - 2025-09-29 13:38:09 --- local-bin/.local/bin/rmq-passwd | 1 - zsh/.config/zsh/completions.zsh | 97 ++++++++++++++------------------- 2 files changed, 42 insertions(+), 56 deletions(-) diff --git a/local-bin/.local/bin/rmq-passwd b/local-bin/.local/bin/rmq-passwd index 9b5684a..999d8ee 100755 --- a/local-bin/.local/bin/rmq-passwd +++ b/local-bin/.local/bin/rmq-passwd @@ -18,7 +18,6 @@ kubectl config set-context --current --namespace=oc-app >/dev/null password=$(kubectl get secret oc-secrets -o jsonpath="{.data.rabbit_passwd}" | base64 --decode) printf "$password" | wl-copy -# printf "$password" | xsel --clipboard # reset context kubectl config use-context $current_context >/dev/null diff --git a/zsh/.config/zsh/completions.zsh b/zsh/.config/zsh/completions.zsh index 46f31c9..ee30dc3 100644 --- a/zsh/.config/zsh/completions.zsh +++ b/zsh/.config/zsh/completions.zsh @@ -1,15 +1,5 @@ #!/bin/zsh -# Completion registration file -# This file handles all completion registrations -# Load custom completion files -for completion_file in ~/.local/share/zsh/*-autocomplete.zsh(N); do - if [ -f "$completion_file" ]; then - source "$completion_file" - fi -done - -# Lazy loading function for completions _lazy_load_completion() { local cmd="$1" local completion_cmd="$2" @@ -21,23 +11,42 @@ _lazy_load_completion() { }" } -# Load lightweight completions immediately -if command -v eza &> /dev/null; then compdef eza=ls; fi +for completion_file in ~/.local/share/zsh/*-autocomplete.zsh(N); do + if [ -f "$completion_file" ]; then + source "$completion_file" + fi +done -# Defer heavy completions with lazy loading -if command -v kubefwd &> /dev/null; then _lazy_load_completion kubefwd "kubefwd completion zsh"; fi -if command -v bombadil &> /dev/null; then _lazy_load_completion bombadil "bombadil generate-completions zsh"; fi +if command -v eza &> /dev/null; then + compdef eza=ls +fi -# Load remaining completions normally (they're lightweight) -if command -v rop &> /dev/null; then eval "$(rop completion zsh)"; fi -if command -v goq &> /dev/null; then eval "$(goq completion zsh)"; fi -if command -v drop &> /dev/null; then eval "$(drop completion zsh)"; fi -if command -v mora &> /dev/null; then eval "$(mora completion zsh)"; fi +if command -v kubefwd &> /dev/null; then + _lazy_load_completion kubefwd "kubefwd completion zsh" +fi + +if command -v bombadil &> /dev/null; then + _lazy_load_completion bombadil "bombadil generate-completions zsh" +fi + +if command -v rop &> /dev/null; then + eval "$(rop completion zsh)" +fi + +if command -v goq &> /dev/null; then + eval "$(goq completion zsh)" +fi + +if command -v drop &> /dev/null; then + eval "$(drop completion zsh)" +fi + +if command -v mora &> /dev/null; then + eval "$(mora completion zsh)" +fi -# Custom completion for kf function using kubectx contexts _kf_completion() { local -a contexts - # Get all contexts and extract unique cluster names (remove -read and -security suffixes) contexts=($(kubectx 2>/dev/null | sed 's/-read$//; s/-security$//' | sort -u)) if [[ ${#contexts[@]} -gt 0 ]]; then @@ -45,9 +54,14 @@ _kf_completion() { fi } -# Register the completion -compdef _kf_completion kf +_rmq_passwd_completion() { + local -a environments + environments=($(kubectl config get-contexts -o name 2>/dev/null | grep '^oc-.*-eks-cluster$' | sed 's/^oc-//; s/-eks-cluster$//' | sort -u)) + if [[ ${#environments[@]} -gt 0 ]]; then + _describe 'environments' environments + fi +} _yay_completion() { local cur prev opts @@ -61,7 +75,6 @@ _yay_completion() { return 0 } - _yay_zsh_completion() { local -a opts opts=( @@ -84,37 +97,11 @@ _yay_zsh_completion() { _describe 'yay commands' opts } -# Enable completion based on shell +compdef _kf_completion kf +compdef _rmq_passwd_completion rmq-passwd + if [[ -n "${BASH_VERSION:-}" ]]; then complete -F _yay_completion yay elif [[ -n "${ZSH_VERSION:-}" ]]; then compdef _yay_zsh_completion yay -fi - -_use_node_completion() { - local -a versions - local script_dir="" - - # Find the script directory - if [ -f "./use-node.sh" ]; then - script_dir="." - else - # Find the actual script location - script_dir="$(dirname "$(readlink -f ~/.local/bin/use-node 2>/dev/null || echo ~/.local/bin/use-node)")" - fi - - # Get versions from nodejs-* directories only - if [ -d "$script_dir" ]; then - versions=($(find "$script_dir" -maxdepth 1 -type d -name "nodejs-*" 2>/dev/null | sed 's/.*nodejs-/node@/')) - fi - - if [[ ${#versions[@]} -gt 0 ]]; then - _describe 'node versions' versions - fi -} - -# Register the completion -compdef _use_node_completion ./use-node.sh -compdef _use_node_completion use-node.sh -compdef _use_node_completion use-node - +fi \ No newline at end of file