From cefd400322fc807826e89b8a2464032478a82767 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 27 Jun 2022 22:01:11 +0100 Subject: [PATCH] config/shell: performance handling adjustments --- .config/shell/browse | 4 ++-- .config/shell/server | 7 ++++--- .local/bin/scripts/git-fuzz | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.config/shell/browse b/.config/shell/browse index 1551949..51582f8 100644 --- a/.config/shell/browse +++ b/.config/shell/browse @@ -81,7 +81,7 @@ zoxide-fzf() { } # Locate directories and add 0 zoxide score locate-zox() { - locate --existing --basename --ignore-case "$@" | + locate --basename --ignore-case "$@" | # TODO too slow # while read -r file; do test -d "$file" && echo "$file"; done | sed 's/^/ 0 /' @@ -95,7 +95,7 @@ d() { # If not select with fzf, using locate to find extra options target="$(if test -n "$query" && expr "$(echo "$query" | sed 's| \+\([^ ]\+\).*|\1|;q')" \> 20 \& \ - $(echo "$query" | sed 'N;s|/.* \([0-9]\+\) */.*|> 10 * \1|;q') >/dev/null #2>&1 + $(echo "$query" | sed 'N;s|/.* \([0-9]\+\)|> 10 * \1|;q' | sed 's| */.*||') >/dev/null #2>&1 then echo "$query" | head -1 else test -n "$query" && echo "$query"; locate-zox "$@" fi | zoxide-fzf)" diff --git a/.config/shell/server b/.config/shell/server index 0ae09b4..e2007bd 100644 --- a/.config/shell/server +++ b/.config/shell/server @@ -1,4 +1,4 @@ -export STACKSPIN="$HOME/stackspin" +export STACKSPIN="${STACKSPIN:-$HOME/projects/stackspin}" _stackspin_cluster_cache=/var/tmp/stackspin-cluster # Stackspin CLI Wrapper @@ -19,6 +19,7 @@ stack() { #export GITLAB_CI="true" echo Selected "$_cluster_name" with IP "$_cluster_ip" echo "$_cluster_name" >"$_stackspin_cluster_cache" + builtin cd "$STACKSPIN" ;; (sso) shift builtin cd "$STACKSPIN" @@ -35,9 +36,9 @@ stack() { # app clis via kubectl (occ) "$0" exec nc-nextcloud -it -- su www-data -s /bin/bash -c "php $*";; (exec) shift - kubectl exec -n $("$0" pod "$1") "${@:2}";; + kubectl exec -n $("$0" pod "$1-[0-9]") "${@:2}";; (pod) shift - kubectl get pods --all-namespaces -o=custom-columns=S:.metadata.namespace,N:.metadata.name --no-headers "${@:2}" | grep --color=never "$1";; + kubectl get pods --all-namespaces --field-selector="status.phase=Running" -o=custom-columns=S:.metadata.namespace,N:.metadata.name --no-headers "${@:2}" | grep --color=never "$1";; # stackspin bare (*) builtin cd "$STACKSPIN" if test $# -gt 1 -a "$1" = install diff --git a/.local/bin/scripts/git-fuzz b/.local/bin/scripts/git-fuzz index 1e01b61..235720a 100755 --- a/.local/bin/scripts/git-fuzz +++ b/.local/bin/scripts/git-fuzz @@ -1,10 +1,11 @@ -#!/bin/sh +#!/bin/bash # Create a commit or stage files via fzf selection # If the first arg is "add", files are staged rather than committed. # All remaining args are passed to the last git command (add or commit). # TODO fix broken prep-commit-msg hook when there is no unifying path # TODO fix broken alt-enter not opening editor --bind='alt-enter:change-prompt(hi>)' +# using bash because of pipefail set -eo pipefail fzfpipe() {