config/shell: performance handling adjustments
This commit is contained in:
parent
7df7c08730
commit
cefd400322
|
@ -81,7 +81,7 @@ zoxide-fzf() {
|
||||||
}
|
}
|
||||||
# Locate directories and add 0 zoxide score
|
# Locate directories and add 0 zoxide score
|
||||||
locate-zox() {
|
locate-zox() {
|
||||||
locate --existing --basename --ignore-case "$@" |
|
locate --basename --ignore-case "$@" |
|
||||||
# TODO too slow
|
# TODO too slow
|
||||||
# while read -r file; do test -d "$file" && echo "$file"; done |
|
# while read -r file; do test -d "$file" && echo "$file"; done |
|
||||||
sed 's/^/ 0 /'
|
sed 's/^/ 0 /'
|
||||||
|
@ -95,7 +95,7 @@ d() {
|
||||||
# If not select with fzf, using locate to find extra options
|
# If not select with fzf, using locate to find extra options
|
||||||
target="$(if test -n "$query" &&
|
target="$(if test -n "$query" &&
|
||||||
expr "$(echo "$query" | sed 's| \+\([^ ]\+\).*|\1|;q')" \> 20 \& \
|
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
|
then echo "$query" | head -1
|
||||||
else test -n "$query" && echo "$query"; locate-zox "$@"
|
else test -n "$query" && echo "$query"; locate-zox "$@"
|
||||||
fi | zoxide-fzf)"
|
fi | zoxide-fzf)"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export STACKSPIN="$HOME/stackspin"
|
export STACKSPIN="${STACKSPIN:-$HOME/projects/stackspin}"
|
||||||
_stackspin_cluster_cache=/var/tmp/stackspin-cluster
|
_stackspin_cluster_cache=/var/tmp/stackspin-cluster
|
||||||
|
|
||||||
# Stackspin CLI Wrapper
|
# Stackspin CLI Wrapper
|
||||||
|
@ -19,6 +19,7 @@ stack() {
|
||||||
#export GITLAB_CI="true"
|
#export GITLAB_CI="true"
|
||||||
echo Selected "$_cluster_name" with IP "$_cluster_ip"
|
echo Selected "$_cluster_name" with IP "$_cluster_ip"
|
||||||
echo "$_cluster_name" >"$_stackspin_cluster_cache"
|
echo "$_cluster_name" >"$_stackspin_cluster_cache"
|
||||||
|
builtin cd "$STACKSPIN"
|
||||||
;;
|
;;
|
||||||
(sso) shift
|
(sso) shift
|
||||||
builtin cd "$STACKSPIN"
|
builtin cd "$STACKSPIN"
|
||||||
|
@ -35,9 +36,9 @@ stack() {
|
||||||
# app clis via kubectl
|
# app clis via kubectl
|
||||||
(occ) "$0" exec nc-nextcloud -it -- su www-data -s /bin/bash -c "php $*";;
|
(occ) "$0" exec nc-nextcloud -it -- su www-data -s /bin/bash -c "php $*";;
|
||||||
(exec) shift
|
(exec) shift
|
||||||
kubectl exec -n $("$0" pod "$1") "${@:2}";;
|
kubectl exec -n $("$0" pod "$1-[0-9]") "${@:2}";;
|
||||||
(pod) shift
|
(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
|
# stackspin bare
|
||||||
(*) builtin cd "$STACKSPIN"
|
(*) builtin cd "$STACKSPIN"
|
||||||
if test $# -gt 1 -a "$1" = install
|
if test $# -gt 1 -a "$1" = install
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# Create a commit or stage files via fzf selection
|
# Create a commit or stage files via fzf selection
|
||||||
# If the first arg is "add", files are staged rather than committed.
|
# 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).
|
# 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 prep-commit-msg hook when there is no unifying path
|
||||||
# TODO fix broken alt-enter not opening editor --bind='alt-enter:change-prompt(hi>)'
|
# TODO fix broken alt-enter not opening editor --bind='alt-enter:change-prompt(hi>)'
|
||||||
|
|
||||||
|
# using bash because of pipefail
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
fzfpipe() {
|
fzfpipe() {
|
||||||
|
|
Loading…
Reference in New Issue