124518c691c7ce94bcd74ee0d520fbfea857fca4

Author
Pavle Portic <git@theedgeofrage.com>
Committer
Pavle Portic <git@theedgeofrage.com>
Date

Message

Make kc a zsh function instead of script

Diff

 1diff --git a/dot_local/bin/executable_kc b/dot_config/zsh/kc.zsh
 2rename from dot_local/bin/executable_kc
 3rename to dot_config/zsh/kc.zsh
 4index 7757ed4be104a0e85dfda2bf4c07489cc47140b7..7bcac5e51b40a90a300597e8e4abdd4712fee7b0 100644
 5--- a/dot_local/bin/executable_kc
 6+++ b/dot_config/zsh/kc.zsh
 7@@ -1,10 +1,4 @@
 8-#!/usr/bin/env bash
 9-
10-[[ -n $DEBUG ]] && set -x
11-
12-set -eou pipefail
13-IFS=$'\n\t'
14-
15+#!/bin/zsh
16 
17 usage() {
18   local SELF
19@@ -32,7 +26,7 @@ current_context() {
20 
21 get_configs() {
22   #kubectl config get-contexts -o=name | sort -n
23-  ls -p --color=never -1 $HOME/.kube | grep -v '/$'
24+  ls -p --color=never -1 $HOME/.kube | \grep -v '/$'
25 }
26 
27 list_configs() {
28@@ -77,19 +71,15 @@ choose_context_interactive() {
29 }
30 
31 set_context() {
32-  echo "Set context to ${1}." >&2
33   export KUBECONFIG="$HOME/.kube/${1}"
34-  echo -e "\n\nYou are in a subshell. Press Ctrl+d for exit!\n\n"
35-  $SHELL
36 }
37 
38 unset_context() {
39-  echo "Unsetting current context." >&2
40+  unset $KUBECONFIG
41   kubectl config unset current-context
42-  echo "Ctrl+d for exiting subshell." >&2
43 }
44 
45-main() {
46+kc() {
47   if [[ "$#" -eq 0 ]]; then
48     if [[ -t 1 &&  -z "${KUBECTX_IGNORE_FZF:-}" && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then
49       choose_context_interactive
50@@ -124,5 +114,3 @@ main() {
51     exit 1
52   fi
53 }
54-
55-main "$@"
56diff --git a/dot_local/bin/executable_flac2mp3 b/dot_local/bin/executable_flac2mp3
57deleted file mode 100644
58index 1dbafe45bf93a2e9cc058300dfd6d239d9a82e5b..0000000000000000000000000000000000000000
59--- a/dot_local/bin/executable_flac2mp3
60+++ /dev/null
61@@ -1,3 +0,0 @@
62-#!/bin/zsh
63-
64-ffmpeg -n -i "$1" -acodec libmp3lame -ab 320k -map_metadata 0 -id3v2_version 3 "$2" &> /dev/null
65diff --git a/dot_zshrc.tmpl b/dot_zshrc.tmpl
66index 2ec4e644ae24ddf2421321bd01536050add50fd3..957ffd54a152dacd17a5fb455a580849da0c9ab0 100644
67--- a/dot_zshrc.tmpl
68+++ b/dot_zshrc.tmpl
69@@ -42,6 +42,7 @@ bindkey -v
70 
71 source ${CUSTOM}/completions/*.zsh
72 source ~/.aliases
73+source ~/.config/zsh/kc.zsh
74 
75 # Variable exports
76 export DEFAULT_USER="pavle"
77@@ -94,8 +95,5 @@ if which pyenv &> /dev/null; then
78 	eval "$(pyenv init -)"
79 fi
80 
81-# Nvm settings
82-[[ -f /usr/share/nvm/init-nvm.sh ]] && source /usr/share/nvm/init-nvm.sh
83-
84 # startx on tty1
85 if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec startx -- vt1; fi