summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2021-10-01 13:27:06 +0200
committerGitHub <[email protected]>2021-10-01 13:27:06 +0200
commita273c46eee751de4a61360ae0076ed4dac433e5d (patch)
tree09ab7027a2920079d251524f92d555f717db45ed /utils
parent52dd273ca9bc552c9bacbdbf697818e75ee993d7 (diff)
feat: add LvimUpdate command (#1634)
* feat: add prelimenary LvimUpdate command * feat: use native process management * feat: add a telescope change-log utility * fix: update readme to include the new command
Diffstat (limited to 'utils')
-rwxr-xr-xutils/installer/install.sh89
1 files changed, 37 insertions, 52 deletions
diff --git a/utils/installer/install.sh b/utils/installer/install.sh
index 972534bd..82e02358 100755
--- a/utils/installer/install.sh
+++ b/utils/installer/install.sh
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
-
set -eo pipefail
#Set branch to master unless specified by the user
@@ -75,52 +74,40 @@ function parse_arguments() {
done
}
+function msg() {
+ local text="$1"
+ local div_width="80"
+ printf "%${div_width}s\n" ' ' | tr ' ' -
+ printf "%s\n" "$text"
+}
+
function main() {
parse_arguments "$@"
- cat <<'EOF'
+ print_logo
- 88\ 88\
- 88 | \__|
- 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\
- 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\
- 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 |
- 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 |
- 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 |
- \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__|
-
-EOF
-
- __add_separator "80"
-
- echo "Detecting platform for managing any additional neovim dependencies"
+ msg "Detecting platform for managing any additional neovim dependencies"
detect_platform
check_system_deps
- __add_separator "80"
-
if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
- echo "Would you like to install lunarvim's NodeJS dependencies?"
+ msg "Would you like to install lunarvim's NodeJS dependencies?"
read -p "[y]es or [n]o (default: no) : " -r answer
[ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps
- echo "Would you like to install lunarvim's Python dependencies?"
+ msg "Would you like to install lunarvim's Python dependencies?"
read -p "[y]es or [n]o (default: no) : " -r answer
[ "$answer" != "${answer#[Yy]}" ] && install_python_deps
- echo "Would you like to install lunarvim's Rust dependencies?"
+ msg "Would you like to install lunarvim's Rust dependencies?"
read -p "[y]es or [n]o (default: no) : " -r answer
[ "$answer" != "${answer#[Yy]}" ] && install_rust_deps
fi
- __add_separator "80"
-
- echo "Backing up old LunarVim configuration"
+ msg "Backing up old LunarVim configuration"
backup_old_config
- __add_separator "80"
-
if [ "$ARGS_OVERWRITE" -eq 1 ]; then
for dir in "${__lvim_dirs[@]}"; do
[ -d "$dir" ] && rm -rf "$dir"
@@ -129,11 +116,8 @@ EOF
install_packer
- __add_separator "80"
-
if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then
- echo "Updating LunarVim"
- update_lvim
+ bash "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/update_lvim.sh"
else
if [ "$ARGS_LOCAL" -eq 1 ]; then
link_local_lvim
@@ -143,7 +127,9 @@ EOF
setup_lvim
fi
- __add_separator "80"
+ msg "Thank you for installing LunarVim!!"
+ echo "You can start it by running: $INSTALL_PREFIX/bin/lvim"
+ echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
}
function detect_platform() {
@@ -287,18 +273,18 @@ function backup_old_config() {
function install_packer() {
if [ -e "$LUNARVIM_PACK_DIR/packer/start/packer.nvim" ]; then
- echo "Packer already installed"
+ msg "Packer already installed"
else
if ! git clone --depth 1 "https://github.com/wbthomason/packer.nvim" \
"$LUNARVIM_PACK_DIR/packer/start/packer.nvim"; then
- echo "Failed to clone Packer. Installation failed."
+ msg "Failed to clone Packer. Installation failed."
exit 1
fi
fi
}
function clone_lvim() {
- echo "Cloning LunarVim configuration"
+ msg "Cloning LunarVim configuration"
if ! git clone --branch "$LV_BRANCH" \
--depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_RUNTIME_DIR/lvim"; then
echo "Failed to clone repository. Installation failed."
@@ -338,12 +324,12 @@ EOF
function remove_old_cache_files() {
local packer_cache="$LUNARVIM_CONFIG_DIR/plugin/packer_compiled.lua"
if [ -e "$packer_cache" ]; then
- echo "Removing old packer cache file"
+ msg "Removing old packer cache file"
rm -f "$packer_cache"
fi
if [ -e "$LUNARVIM_CACHE_DIR/luacache" ] || [ -e "$LUNARVIM_CACHE_DIR/lvim_cache" ]; then
- echo "Removing old startup cache file"
+ msg "Removing old startup cache file"
rm -f "$LUNARVIM_CACHE_DIR/{luacache,lvim_cache}"
fi
}
@@ -352,7 +338,7 @@ function setup_lvim() {
remove_old_cache_files
- echo "Installing LunarVim shim"
+ msg "Installing LunarVim shim"
setup_shim
@@ -368,26 +354,25 @@ function setup_lvim() {
echo "Packer setup complete"
cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua"
-
- echo "Thank you for installing LunarVim!!"
- echo "You can start it by running: $INSTALL_PREFIX/bin/lvim"
- echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
}
function update_lvim() {
- git -C "$LUNARVIM_RUNTIME_DIR/lvim" fetch --quiet
- if ! git -C "$LUNARVIM_RUNTIME_DIR/lvim" diff --quiet "@{upstream}"; then
- git -C "$LUNARVIM_RUNTIME_DIR/lvim" merge --ff-only --progress ||
- echo "Unable to guarantee data integrity while updating. Please do that manually instead." && exit 1
- fi
- echo "Clearing up old startup cache"
- "$INSTALL_PREFIX/bin/lvim" --headless +LvimCacheReset +q
- echo "Your LunarVim installation is now up to date!"
+ "$INSTALL_PREFIX/bin/lvim" --headless +'LvimUpdate' +q
}
-function __add_separator() {
- local DIV_WIDTH="$1"
- printf "%${DIV_WIDTH}s\n" ' ' | tr ' ' -
+function print_logo() {
+ cat <<'EOF'
+
+ 88\ 88\
+ 88 | \__|
+ 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\
+ 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\
+ 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 |
+ 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 |
+ 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 |
+ \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__|
+
+EOF
}
main "$@"