From 44ef4d54b61c4e637f8e87980c4568e9e4a1a004 Mon Sep 17 00:00:00 2001 From: wolandark Date: Thu, 27 Jun 2024 07:06:50 +0330 Subject: [PATCH] update script spitout added --- symlink.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/symlink.sh b/symlink.sh index 4d6cb34..5ffa631 100755 --- a/symlink.sh +++ b/symlink.sh @@ -80,12 +80,55 @@ linkFiles() echo "[[Wim]]" > "$_WIKI_DIR/$_VIMWIKI_INDEX" } +createUpdateScript() +{ +cat << 'EOF' > update.sh +#!/bin/sh + +# Check parent wim dir exists +checkWimExist() +{ + if [ "$parent_dir" = "wim" ]; then + printf "Wim Directory Exists!\nProceeding ...\n" + else + printf "Wim Directory Does Not Exists!\nBreaking! ...\n" + exit 1 + fi + + if [ -d "$_CONFIG_DIR" ]; then + printf "Config Directory Exists!\nProceeding ...\n" + else + printf "Config Directory Does Not Exists!\nBreaking! ...\n" + exit 1 + fi +} + +# link the files +linkFiles() +{ + printf "\e[42;30mSymlinking Latest Vimrc\e[0m\n" + ln -sf "$(pwd)/$_VIMRC_FILE" "$_VIMRC_FILE_DEST" + printf "\e[42;30mSymlinking Latest CoC Settings\e[0m\n" + ln -sf "$(pwd)/$_COC_FILE" "$_COC_FILE_DEST" + printf "\e[42;30mSymlinking Latest Wim Wiki\e[0m\n" + ln -sf "$(pwd)/$_WIKI_FILE" "$_WIKI_FILE_DEST" + printf "\e[42;30mSymlinking Latest Cheat File\e[0m\n" + ln -sf "$(pwd)/$_CHEAT_FILE" "$_CHEAT_FILE_DEST" + echo "" + echo "[[Wim]]" > "$_WIKI_DIR/$_VIMWIKI_INDEX" +} +EOF + +chmod +x update.sh +echo "Update Script Generated!" +} main() { backup downloadCtags checkWimExist linkFiles + createUpdateScript } main