2023-02-10 01:39:34 +07:00
|
|
|
|
#!/usr/bin/fish
|
|
|
|
|
|
2023-02-12 17:48:16 +07:00
|
|
|
|
# Инициализация текста сообщений в зависимости от установленного языка в оболочке
|
|
|
|
|
if test (string match -ri "ru" "$LANG")
|
2023-03-26 23:16:49 +07:00
|
|
|
|
function print -a TYPE PARAM1 PARAM2 -d "Текст сообщений"
|
2023-02-12 17:48:16 +07:00
|
|
|
|
switch $TYPE
|
|
|
|
|
case REPOSITORY_EXISTS
|
2023-03-26 23:16:49 +07:00
|
|
|
|
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[ЗАДАЧА] "; set_color white; echo "Репозиторий \"wbthomason/packer.nvim\" уже существует. Переустановить? (y/N) ";
|
2023-02-12 17:48:16 +07:00
|
|
|
|
case REPOSITORY_CREATED
|
|
|
|
|
set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[РАБОТА] "; set_color white; echo "Репозиторий \"wbthomason/packer.nvim\" установлен";
|
2023-03-26 23:16:49 +07:00
|
|
|
|
case FORMATTER_NGINX_INSTALL
|
|
|
|
|
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[ЗАДАЧА] "; set_color white; echo "Установить форматировщик для NGINX? (\"vasilevich/nginxbeautifier\") (y/N) ";
|
2023-02-12 17:48:16 +07:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
2023-03-26 23:16:49 +07:00
|
|
|
|
function print -a TYPE PARAM1 PARAM2 -d "Messages text"
|
2023-02-12 17:48:16 +07:00
|
|
|
|
switch $TYPE
|
|
|
|
|
case REPOSITORY_EXISTS
|
2023-03-26 23:16:49 +07:00
|
|
|
|
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "The \"wbthomason/packer.nvim\" repository already exists. Reinstall? (y/N) ";
|
2023-02-12 17:48:16 +07:00
|
|
|
|
case REPOSITORY_CREATED
|
2023-03-26 23:16:49 +07:00
|
|
|
|
set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Repository \"wbthomason/packer.nvim\" installed";
|
|
|
|
|
case FORMATTER_NGINX_INSTALL
|
|
|
|
|
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Install the formatter for NGINX? (\"vasilevich/nginxbeautifier\") (y/N) ";
|
2023-02-12 17:48:16 +07:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2023-02-10 01:39:34 +07:00
|
|
|
|
|
2023-02-12 17:48:16 +07:00
|
|
|
|
if test -d ~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
|
|
|
|
# Найден репозиторий "wbthomason/packer.nvim"
|
|
|
|
|
|
|
|
|
|
# Запрос выбора действия с репозиторием
|
|
|
|
|
set RESPONSE (read -n 1 -p "print REPOSITORY_EXISTS")
|
|
|
|
|
bind -e y
|
|
|
|
|
|
|
|
|
|
if test (string match -ri 'y' "$RESPONSE")
|
|
|
|
|
# Запрошена переустановка
|
|
|
|
|
|
|
|
|
|
# Деинициализация старого репозитория
|
|
|
|
|
rm -rf ~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
|
|
|
|
|
|
|
|
|
# Инициализация репозиторий
|
|
|
|
|
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
|
|
|
|
|
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
|
|
|
|
|
|
|
|
|
print REPOSITORY_CREATED
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
# Не найден репозиторий "wbthomason/packer.nvim"
|
|
|
|
|
|
|
|
|
|
# Инициализация репозитория
|
|
|
|
|
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
|
|
|
|
|
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
|
|
|
|
|
|
|
|
|
print REPOSITORY_CREATED
|
|
|
|
|
end
|
2023-03-26 23:16:49 +07:00
|
|
|
|
|
|
|
|
|
# Запрос выбора действия с репозиторием
|
|
|
|
|
set RESPONSE (read -n 1 -p "print FORMATTER_NGINX_INSTALL")
|
|
|
|
|
bind -e y
|
|
|
|
|
|
|
|
|
|
if test (string match -ri 'y' "$RESPONSE")
|
|
|
|
|
# Запрошена установка 'vasilevich/nginxbeautifier'
|
|
|
|
|
|
|
|
|
|
# Установка
|
|
|
|
|
npm install -g nginxbeautifier
|
|
|
|
|
end
|
|
|
|
|
|