config/shell: performance handling adjustments

This commit is contained in:
xeruf 2022-06-27 22:01:11 +01:00
parent 7df7c08730
commit cefd400322
3 changed files with 8 additions and 6 deletions

View File

@ -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)"

View File

@ -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

View File

@ -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() {