Code Update
This commit is contained in:
parent
a614d63d1c
commit
e1b05fbc51
@ -2,7 +2,7 @@ wx-auto(){
|
||||
wx-login
|
||||
wx-header "Auto"
|
||||
|
||||
wx-ssh-config-sync
|
||||
wx-ssh-keys-sync
|
||||
wx-ssh-config sync
|
||||
wx-ssh-keys sync
|
||||
wx-ssh-sign
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ wx-login(){
|
||||
else
|
||||
USERNAME=$SUDO_USER
|
||||
fi
|
||||
else
|
||||
USERNAME=$USER
|
||||
fi
|
||||
|
||||
VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/sys/health)
|
||||
@ -90,7 +92,7 @@ wx-login(){
|
||||
config["login",${ORG}]=$VAULT_LOGIN
|
||||
if [[ $USER != "root" && $USER != "local" ]]
|
||||
then
|
||||
jq '.login.'$ORG' = "'$VAULT_LOGIN'"' $HOME/.config/warengroup/config.json &> $HOME/.config/warengroup/config.json.tmp
|
||||
jq '.login.'$ORG' = "'$VAULT_LOGIN'"' $HOME/.config/warengroup/config.json 1> $HOME/.config/warengroup/config.json.tmp
|
||||
mv $HOME/.config/warengroup/config.json.tmp $HOME/.config/warengroup/config.json &> /dev/null
|
||||
fi
|
||||
else
|
||||
@ -131,8 +133,6 @@ wx-login(){
|
||||
jq '.login.'$ORG' = "'$VAULT_LOGIN'"' $HOME/.config/warengroup/config.json &> $HOME/.config/warengroup/config.json.tmp
|
||||
mv $HOME/.config/warengroup/config.json.tmp $HOME/.config/warengroup/config.json &> /dev/null
|
||||
fi
|
||||
|
||||
wx-start
|
||||
fi
|
||||
else
|
||||
wx-header "Login"
|
||||
@ -162,8 +162,6 @@ wx-login(){
|
||||
jq '.login.'$ORG' = "'$VAULT_LOGIN'"' $HOME/.config/warengroup/config.json &> $HOME/.config/warengroup/config.json.tmp
|
||||
mv $HOME/.config/warengroup/config.json.tmp $HOME/.config/warengroup/config.json &> /dev/null
|
||||
fi
|
||||
|
||||
wx-start
|
||||
fi
|
||||
fi
|
||||
else
|
||||
|
@ -1,3 +1,8 @@
|
||||
wx-logout(){
|
||||
wx-header "Logout"
|
||||
if [[ $USER != "root" && $USER != "local" ]]
|
||||
then
|
||||
jq '.login = {}' $HOME/.config/warengroup/config.json &> $HOME/.config/warengroup/config.json.tmp
|
||||
mv $HOME/.config/warengroup/config.json.tmp $HOME/.config/warengroup/config.json &> /dev/null
|
||||
fi
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
wx-header(){
|
||||
if [[ $2 == "h1" ]]
|
||||
then
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "=============================="
|
||||
wx-repeat " " $((30/2-${#1}/2))
|
||||
echo -n "$wxBold"
|
||||
|
@ -1,13 +1,13 @@
|
||||
wx-start(){
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
wx-header "Warén CLI" h1
|
||||
|
||||
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||
|
||||
if [[ ! -f "$HOME/.config/warengroup/config.json" ]]
|
||||
if [[ $USER != "root" && $USER != "local" ]]
|
||||
then
|
||||
echo '{}' | jq > $HOME/.config/warengroup/config.json
|
||||
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||
|
||||
if [[ ! -f "$HOME/.config/warengroup/config.json" ]]
|
||||
then
|
||||
echo '{}' | jq > $HOME/.config/warengroup/config.json
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
34
wx
34
wx
@ -22,6 +22,9 @@ declare -Ax config
|
||||
wx-header(){
|
||||
if [[ $2 == "h1" ]]
|
||||
then
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "=============================="
|
||||
wx-repeat " " $((30/2-${#1}/2))
|
||||
echo -n "$wxBold"
|
||||
@ -59,16 +62,16 @@ wx-restricted(){
|
||||
}
|
||||
|
||||
wx-start(){
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
wx-header "Warén CLI" h1
|
||||
|
||||
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||
|
||||
if [[ ! -f "$HOME/.config/warengroup/config.json" ]]
|
||||
if [[ $USER != "root" && $USER != "local" ]]
|
||||
then
|
||||
echo '{}' | jq > $HOME/.config/warengroup/config.json
|
||||
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||
|
||||
if [[ ! -f "$HOME/.config/warengroup/config.json" ]]
|
||||
then
|
||||
echo '{}' | jq > $HOME/.config/warengroup/config.json
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -86,8 +89,8 @@ wx-auto(){
|
||||
wx-login
|
||||
wx-header "Auto"
|
||||
|
||||
wx-ssh-config-sync
|
||||
wx-ssh-keys-sync
|
||||
wx-ssh-config sync
|
||||
wx-ssh-keys sync
|
||||
wx-ssh-sign
|
||||
}
|
||||
|
||||
@ -258,6 +261,8 @@ wx-login(){
|
||||
else
|
||||
USERNAME=$SUDO_USER
|
||||
fi
|
||||
else
|
||||
USERNAME=$USER
|
||||
fi
|
||||
|
||||
VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/sys/health)
|
||||
@ -275,7 +280,7 @@ wx-login(){
|
||||
config["login",${ORG}]=$VAULT_LOGIN
|
||||
if [[ $USER != "root" && $USER != "local" ]]
|
||||
then
|
||||
jq '.login.'$ORG' = "'$VAULT_LOGIN'"' $HOME/.config/warengroup/config.json &> $HOME/.config/warengroup/config.json.tmp
|
||||
jq '.login.'$ORG' = "'$VAULT_LOGIN'"' $HOME/.config/warengroup/config.json 1> $HOME/.config/warengroup/config.json.tmp
|
||||
mv $HOME/.config/warengroup/config.json.tmp $HOME/.config/warengroup/config.json &> /dev/null
|
||||
fi
|
||||
else
|
||||
@ -316,8 +321,6 @@ wx-login(){
|
||||
jq '.login.'$ORG' = "'$VAULT_LOGIN'"' $HOME/.config/warengroup/config.json &> $HOME/.config/warengroup/config.json.tmp
|
||||
mv $HOME/.config/warengroup/config.json.tmp $HOME/.config/warengroup/config.json &> /dev/null
|
||||
fi
|
||||
|
||||
wx-start
|
||||
fi
|
||||
else
|
||||
wx-header "Login"
|
||||
@ -347,8 +350,6 @@ wx-login(){
|
||||
jq '.login.'$ORG' = "'$VAULT_LOGIN'"' $HOME/.config/warengroup/config.json &> $HOME/.config/warengroup/config.json.tmp
|
||||
mv $HOME/.config/warengroup/config.json.tmp $HOME/.config/warengroup/config.json &> /dev/null
|
||||
fi
|
||||
|
||||
wx-start
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@ -361,6 +362,11 @@ wx-login(){
|
||||
|
||||
wx-logout(){
|
||||
wx-header "Logout"
|
||||
if [[ $USER != "root" && $USER != "local" ]]
|
||||
then
|
||||
jq '.login = {}' $HOME/.config/warengroup/config.json &> $HOME/.config/warengroup/config.json.tmp
|
||||
mv $HOME/.config/warengroup/config.json.tmp $HOME/.config/warengroup/config.json &> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
wx-settings(){
|
||||
|
Loading…
Reference in New Issue
Block a user