mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
#new-plugin follow Conventions
This commit is contained in:
parent
ee19e2b847
commit
43079320a2
1 changed files with 6 additions and 6 deletions
|
@ -3,21 +3,21 @@ add-zsh-hook precmd _restore_cache
|
||||||
|
|
||||||
FILE_CREDENTIALS="${HOME}/.vault-switch/credentials"
|
FILE_CREDENTIALS="${HOME}/.vault-switch/credentials"
|
||||||
|
|
||||||
function _restore_cache(){
|
_restore_cache(){
|
||||||
[ ! -d ${HOME}/.vault-switch ] && mkdir -p ${HOME}/.vault-switch
|
[ ! -d ${HOME}/.vault-switch ] && mkdir -p ${HOME}/.vault-switch
|
||||||
[ ! -f $FILE_CREDENTIALS ] && touch ${FILE_CREDENTIALS}
|
[ ! -f $FILE_CREDENTIALS ] && touch ${FILE_CREDENTIALS}
|
||||||
source ${FILE_CREDENTIALS}
|
source ${FILE_CREDENTIALS}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _get-nodes(){
|
_get-nodes(){
|
||||||
IFS=";" read -A NODES <<< ${VAULT_NODES}
|
IFS=";" read -A NODES <<< ${VAULT_NODES}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _set-color(){
|
_set-color(){
|
||||||
echo "\e[1;32m$1\e[0m"
|
echo "\e[1;32m$1\e[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _list-nodes(){
|
_list-nodes(){
|
||||||
INDEX=1
|
INDEX=1
|
||||||
for i in ${NODES[@]}
|
for i in ${NODES[@]}
|
||||||
do
|
do
|
||||||
|
@ -29,7 +29,7 @@ function _list-nodes(){
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function _set-work-node(){
|
_set-work-node(){
|
||||||
if [ $1 -gt ${#NODES[@]} ]
|
if [ $1 -gt ${#NODES[@]} ]
|
||||||
then
|
then
|
||||||
echo "Number of node not found"
|
echo "Number of node not found"
|
||||||
|
@ -50,7 +50,7 @@ function _set-work-node(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function vault-switch() {
|
vault-switch() {
|
||||||
_get-nodes
|
_get-nodes
|
||||||
[ ! $1 ] && _list-nodes
|
[ ! $1 ] && _list-nodes
|
||||||
[ $1 ] && _set-work-node $1
|
[ $1 ] && _set-work-node $1
|
||||||
|
|
Loading…
Reference in a new issue