Make kc a zsh function instead of script
This commit is contained in:
parent
e5a24d1dda
commit
124518c691
|
@ -1,10 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
[[ -n $DEBUG ]] && set -x
|
||||
|
||||
set -eou pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
#!/bin/zsh
|
||||
|
||||
usage() {
|
||||
local SELF
|
||||
|
@ -32,7 +26,7 @@ current_context() {
|
|||
|
||||
get_configs() {
|
||||
#kubectl config get-contexts -o=name | sort -n
|
||||
ls -p --color=never -1 $HOME/.kube | grep -v '/$'
|
||||
ls -p --color=never -1 $HOME/.kube | \grep -v '/$'
|
||||
}
|
||||
|
||||
list_configs() {
|
||||
|
@ -77,19 +71,15 @@ choose_context_interactive() {
|
|||
}
|
||||
|
||||
set_context() {
|
||||
echo "Set context to ${1}." >&2
|
||||
export KUBECONFIG="$HOME/.kube/${1}"
|
||||
echo -e "\n\nYou are in a subshell. Press Ctrl+d for exit!\n\n"
|
||||
$SHELL
|
||||
}
|
||||
|
||||
unset_context() {
|
||||
echo "Unsetting current context." >&2
|
||||
unset $KUBECONFIG
|
||||
kubectl config unset current-context
|
||||
echo "Ctrl+d for exiting subshell." >&2
|
||||
}
|
||||
|
||||
main() {
|
||||
kc() {
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
if [[ -t 1 && -z "${KUBECTX_IGNORE_FZF:-}" && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then
|
||||
choose_context_interactive
|
||||
|
@ -124,5 +114,3 @@ main() {
|
|||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/zsh
|
||||
|
||||
ffmpeg -n -i "$1" -acodec libmp3lame -ab 320k -map_metadata 0 -id3v2_version 3 "$2" &> /dev/null
|
|
@ -42,6 +42,7 @@ bindkey -v
|
|||
|
||||
source ${CUSTOM}/completions/*.zsh
|
||||
source ~/.aliases
|
||||
source ~/.config/zsh/kc.zsh
|
||||
|
||||
# Variable exports
|
||||
export DEFAULT_USER="pavle"
|
||||
|
@ -94,8 +95,5 @@ if which pyenv &> /dev/null; then
|
|||
eval "$(pyenv init -)"
|
||||
fi
|
||||
|
||||
# Nvm settings
|
||||
[[ -f /usr/share/nvm/init-nvm.sh ]] && source /usr/share/nvm/init-nvm.sh
|
||||
|
||||
# startx on tty1
|
||||
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec startx -- vt1; fi
|
||||
|
|
Loading…
Reference in New Issue