Compare commits
No commits in common. "118f7e44a9c2f66f2673f3447280619abacf6413" and "25704480676687b7fac999cd09a76097fd4fc588" have entirely different histories.
118f7e44a9
...
2570448067
@ -1,27 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# shellcheck disable=2045,2086
|
# shellcheck disable=2045,2086
|
||||||
|
|
||||||
ZSHFOLDER=$HOME/.config/zsh
|
|
||||||
CONFIG="$HOME/.config"
|
|
||||||
|
|
||||||
# Colours
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[0;0;32m'
|
|
||||||
NC='\033[0m'
|
|
||||||
|
|
||||||
function timestamp() {
|
function timestamp() {
|
||||||
echo -e "${GREEN}[+]${NC} $(date +'%F %T') [INFO] $*"
|
echo "[+] $(date +'%F %T') [INFO] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
function err() {
|
function err() {
|
||||||
echo -e "${RED}[-] $(date +'%F %T') [ERROR] $*${NC}" >&2
|
echo "[-] $(date +'%F %T') [ERROR] $*" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
function command_start() {
|
function command_start() {
|
||||||
timestamp "Command $* has been started."
|
timestamp "Command $* has been started."
|
||||||
if ! "$*"; then
|
if ! "$*"; then
|
||||||
err "Command $* went wrong."
|
err "Command $* went wrong."
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
timestamp "Command $* has been ended."
|
timestamp "Command $* has been ended."
|
||||||
}
|
}
|
||||||
@ -33,22 +24,22 @@ function update_pip() {
|
|||||||
|
|
||||||
function install_neovim_module_for_python() {
|
function install_neovim_module_for_python() {
|
||||||
# Python module in neovim
|
# Python module in neovim
|
||||||
pip3 install neovim --pre --user --force --quiet
|
pip3 install neovim --pre --user --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_pyright() {
|
function install_pyright() {
|
||||||
# Install pyright
|
# Install pyright
|
||||||
sudo npm -s -g i pyright --force
|
sudo npm -g i pyright --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_bash-language-server() {
|
function install_bash-language-server() {
|
||||||
# Install bash-language-server
|
# Install bash-language-server
|
||||||
sudo npm -s -g i bash-language-server --force
|
sudo npm -g i bash-language-server --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_yaml-language-server() {
|
function install_yaml-language-server() {
|
||||||
# Install yaml-language-server
|
# Install yaml-language-server
|
||||||
sudo npm -s -g i yaml-language-server --force
|
sudo npm -g i yaml-language-server --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_shfmt() {
|
function install_shfmt() {
|
||||||
@ -61,7 +52,7 @@ function install_terraform() {
|
|||||||
GO111MODULE=on go install github.com/hashicorp/terraform@latest
|
GO111MODULE=on go install github.com/hashicorp/terraform@latest
|
||||||
GO111MODULE=on go install github.com/hashicorp/terraform-ls@latest
|
GO111MODULE=on go install github.com/hashicorp/terraform-ls@latest
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then
|
if [[ "$(uname)" == "Darwin" ]]; then
|
||||||
brew install tflint -q
|
brew install tflint
|
||||||
else
|
else
|
||||||
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
|
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
|
||||||
fi
|
fi
|
||||||
@ -70,7 +61,7 @@ function install_terraform() {
|
|||||||
function install_terragrunt() {
|
function install_terragrunt() {
|
||||||
# Install terragrunt
|
# Install terragrunt
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then
|
if [[ "$(uname)" == "Darwin" ]]; then
|
||||||
brew install terragrunt -q
|
brew install terragrunt
|
||||||
else
|
else
|
||||||
wget https://github.com/gruntwork-io/terragrunt/releases/latest/download/terragrunt_linux_amd64 -O $HOME/.local/bin/terragrunt
|
wget https://github.com/gruntwork-io/terragrunt/releases/latest/download/terragrunt_linux_amd64 -O $HOME/.local/bin/terragrunt
|
||||||
chmod +x $HOME/.local/bin/terragrunt
|
chmod +x $HOME/.local/bin/terragrunt
|
||||||
@ -80,7 +71,7 @@ function install_terragrunt() {
|
|||||||
function install_shellcheck() {
|
function install_shellcheck() {
|
||||||
# Install shellcheck
|
# Install shellcheck
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then
|
if [[ "$(uname)" == "Darwin" ]]; then
|
||||||
brew install shellcheck -q
|
brew install shellcheck
|
||||||
else
|
else
|
||||||
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
|
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
|
||||||
fi
|
fi
|
||||||
@ -93,77 +84,46 @@ function install_gopls() {
|
|||||||
|
|
||||||
function install_black() {
|
function install_black() {
|
||||||
# Install black
|
# Install black
|
||||||
pip3 install black --pre --user --force --quiet
|
pip3 install black --pre --user --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_ansible() {
|
function install_ansible() {
|
||||||
# Install Ansible
|
# Install Ansible
|
||||||
pip3 install ansible ansible-lint ansible-core --pre --user --force --quiet
|
pip3 install --pre --user ansible ansible-lint ansible-core --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_ansible-language-server() {
|
function install_ansible-language-server() {
|
||||||
# Install ansible-language-server
|
# Install ansible-language-server
|
||||||
sudo npm -s -g i @ansible/ansible-language-server --force
|
sudo npm -g i @ansible/ansible-language-server --force
|
||||||
sudo npm -s -g i yaml-language-server --force
|
sudo npm -g i yaml-language-server --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_meraki_ansible() {
|
function install_meraki_ansible() {
|
||||||
# Install python, ansible module for meraki
|
# Install python, ansible module for meraki
|
||||||
ansible-galaxy collection install cisco.meraki --force
|
ansible-galaxy collection install cisco.meraki --force
|
||||||
pip3 install meraki --user --force --quiet
|
pip3 install meraki --user --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_azure_cli() {
|
function install_azure_cli() {
|
||||||
# Install azure_cli
|
# Install azure_cli
|
||||||
pip3 install azure-cli --pre --user --force --quiet
|
pip3 install azure-cli --user --pre --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_awscli() {
|
function install_awscli() {
|
||||||
# Install awscli
|
# Install awscli
|
||||||
pip3 install awscli --pre --user --force --quiet
|
pip3 install awscli --pre --user --force
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update_zsh() {
|
||||||
if [ -d $CONFIG/fzf ]; then
|
mkdir -p "$ZSHFOLDER/azure-cli" "$ZSHFOLDER/aws"
|
||||||
FOLDER="$CONFIG/fzf"
|
for i in $(ls $HOME/.config/zsh); do
|
||||||
cd $FOLDER || err "Folder $FOLDER has been NOT found"
|
FOLDER="$HOME/.config/zsh/$i"
|
||||||
git pull -q && timestamp "Pulling the $FOLDER configuration"
|
cd "$FOLDER" || echo "Folder is not exists"
|
||||||
else
|
git pull
|
||||||
FOLDER="$CONFIG/fzf"
|
|
||||||
git clone https://github.com/junegunn/fzf.git $FOLDER && timestamp "Cloning the FZF"
|
|
||||||
git pull -q && timestamp "Pulling the $FOLDER configuration"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d $ZSHFOLDER/aws ]; then
|
|
||||||
curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh \
|
|
||||||
-o "$ZSHFOLDER"/aws/aws.plugin.zsh &&
|
|
||||||
timestamp "Downloaded the newest version of aws plugin for zsh"
|
|
||||||
|
|
||||||
curl -s https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion \
|
|
||||||
-o "$ZSHFOLDER"/azure-cli/az.completion &&
|
|
||||||
timestamp "Downloaded the newest version of az plugin for zsh"
|
|
||||||
|
|
||||||
mkdir -p "$ZSHFOLDER/azure-cli" "$ZSHFOLDER/aws"
|
|
||||||
cd $ZSHFOLDER || err "Folder $ZSHFOLDER has been NOT found"
|
|
||||||
git clone https://github.com/popstas/zsh-command-time.git &&
|
|
||||||
timestamp "Cloning the zsh-command-time"
|
|
||||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git &&
|
|
||||||
timestamp "Cloning the zsh-syntax-highlighting"
|
|
||||||
git clone https://github.com/zsh-users/zsh-autosuggestions.git &&
|
|
||||||
timestamp "Cloning the zsh-autosuggestions"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for i in $(ls $ZSHFOLDER); do
|
|
||||||
FOLDER="$ZSHFOLDER/$i"
|
|
||||||
if [ -d "$FOLDER/.git" ]; then
|
|
||||||
cd "$FOLDER" || err "Folder $FOLDER has been NOT found"
|
|
||||||
git pull -q && timestamp "Pulling the $FOLDER configuration"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
ZSHFOLDER="$HOME/.config/zsh/"
|
||||||
curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh -o "$ZSHFOLDER"/aws/aws.plugin.zsh && timestamp "Downloaded the newest version of aws plugin for zsh"
|
curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh -o "$ZSHFOLDER"/aws/aws.plugin.zsh
|
||||||
curl -s https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion -o "$ZSHFOLDER"/azure-cli/az.completion && timestamp "Downloaded the newest version of az plugin for zsh"
|
curl -s https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion -o "$ZSHFOLDER"/azure-cli/az.completion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
@ -181,7 +141,7 @@ function main() {
|
|||||||
command_start install_black
|
command_start install_black
|
||||||
command_start install_ansible
|
command_start install_ansible
|
||||||
command_start install_meraki_ansible
|
command_start install_meraki_ansible
|
||||||
command_start update
|
command_start update_zsh
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
14
.zshrc
14
.zshrc
@ -33,12 +33,23 @@ plugins=(rake ruby vagrant knife knife_ssh kitchen )
|
|||||||
ZSH_DISABLE_COMPFIX=true
|
ZSH_DISABLE_COMPFIX=true
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
if [ ! -d $CONFIG/zsh/aws ]; then
|
||||||
|
mkdir -p $CONFIG/zsh/aws
|
||||||
|
mkdir -p $CONFIG/zsh/azure-cli
|
||||||
|
cd $CONFIG/zsh
|
||||||
|
git clone https://github.com/popstas/zsh-command-time.git
|
||||||
|
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
|
||||||
|
git clone https://github.com/zsh-users/zsh-autosuggestions.git
|
||||||
|
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh -o $CONFIG/zsh/aws/aws.plugin.zsh
|
||||||
|
curl https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion -o $CONFIG/zsh/azure-cli/az.completion
|
||||||
|
fi
|
||||||
[ -d $CONFIG/zsh/zsh-autosuggestions ] && source $CONFIG/zsh/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh &>> /dev/null
|
[ -d $CONFIG/zsh/zsh-autosuggestions ] && source $CONFIG/zsh/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh &>> /dev/null
|
||||||
[ -d $CONFIG/zsh/zsh-syntax-highlighting ] && source $CONFIG/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh &>> /dev/null
|
[ -d $CONFIG/zsh/zsh-syntax-highlighting ] && source $CONFIG/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh &>> /dev/null
|
||||||
[ -d $CONFIG/zsh/zsh-command-time ] && source $CONFIG/zsh/zsh-command-time/command-time.plugin.zsh &>> /dev/null
|
[ -d $CONFIG/zsh/zsh-command-time ] && source $CONFIG/zsh/zsh-command-time/command-time.plugin.zsh &>> /dev/null
|
||||||
[ -d $CONFIG/zsh/aws ] && source $CONFIG/zsh/aws/aws.plugin.zsh &>> /dev/null
|
[ -d $CONFIG/zsh/aws ] && source $CONFIG/zsh/aws/aws.plugin.zsh &>> /dev/null
|
||||||
[ -d $CONFIG/zsh/azure-cli ] && source $CONFIG/zsh/azure-cli/az.completion &>> /dev/null
|
[ -d $CONFIG/zsh/azure-cli ] && source $CONFIG/zsh/azure-cli/az.completion &>> /dev/null
|
||||||
[ -f $HOME/.password ] && source $HOME/.password
|
[ -f $HOME/.password ] && source $HOME/.password
|
||||||
|
[ ! -d $CONFIG/fzf ] && git clone https://github.com/junegunn/fzf.git $HOME/.config/fzf
|
||||||
[ -f $CONFIG/fzf/shell/key-bindings.zsh ] && source $HOME/.config/fzf/shell/key-bindings.zsh
|
[ -f $CONFIG/fzf/shell/key-bindings.zsh ] && source $HOME/.config/fzf/shell/key-bindings.zsh
|
||||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||||
FPATH=/usr/local/share/zsh/site-functions:$FPATH
|
FPATH=/usr/local/share/zsh/site-functions:$FPATH
|
||||||
@ -191,8 +202,7 @@ alias gch="git checkout"
|
|||||||
alias gst="git status -s"
|
alias gst="git status -s"
|
||||||
alias gdiff="git --no-pager diff"
|
alias gdiff="git --no-pager diff"
|
||||||
alias glog="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches"
|
alias glog="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches"
|
||||||
alias gshow="git --no-pager show --color --pretty=format:%b"
|
alias gshow="git show --color --pretty=format:%b"
|
||||||
alias gd=gshow
|
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
alias channel-check='sudo iwlist wlan0 scan | egrep -i "essid|frequency"'
|
alias channel-check='sudo iwlist wlan0 scan | egrep -i "essid|frequency"'
|
||||||
|
Loading…
Reference in New Issue
Block a user