added colors

This commit is contained in:
ION606
2024-06-26 13:11:19 -04:00
parent 2d5339da4d
commit 8508284ae9
8 changed files with 28 additions and 23 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ A future version control system and file sharing system built over rsync and ins
## Running ## Running
## Option 1: The Script ## Option 1: The Script
just use `curl -fsSL -o ivcs.sh https://github.com/ION606/VCS/raw/main/init.sh && chmod +x ivcs.sh && sudo ./ivcs.sh` just use `curl -fsSL -o ivcs.sh https://github.com/ION606/VCS/raw/main/init.sh && chmod +x ivcs.sh && ./ivcs.sh`
## Option 2: Maually ## Option 2: Maually
+3 -2
View File
@@ -6,7 +6,7 @@ mkdir -p .ionvcs
# Check if a path is provided as an argument # Check if a path is provided as an argument
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "please provide a path to clone (like ~/Desktop/code_here)" echo -e "\e[31mERROR!\e[0m please provide a path to clone (like \e[34m~/Desktop/code_here\e[0m)"
exit 1 exit 1
fi fi
@@ -20,11 +20,12 @@ fi
# Create the destination folder if it doesn't exist # Create the destination folder if it doesn't exist
mkdir -p "$DEST_FOLDER" mkdir -p "$DEST_FOLDER"
# Source the credentials file if it exists # Source the credentials file if it exists
if [ -f "$HOME/ionsrc/creds.txt" ]; then if [ -f "$HOME/ionsrc/creds.txt" ]; then
source "$HOME/ionsrc/creds.txt" source "$HOME/ionsrc/creds.txt"
else else
echo "credentials file not found! (please use the login command)" echo -e "\e[31mcredentials file not found!\e[0m (please use the \e[0;32mlogin\e[0m command)"
exit 1 exit 1
fi fi
+1 -1
View File
@@ -2,7 +2,7 @@
if [ -f "$HOME/ionsrc/creds.txt" ]; then if [ -f "$HOME/ionsrc/creds.txt" ]; then
source "$HOME/ionsrc/creds.txt" source "$HOME/ionsrc/creds.txt"
echo "logged in as $username!" echo "logged in as \033[0;31m$username\e[0m!"
else else
echo "no user found!" echo "no user found!"
fi fi
+3 -2
View File
@@ -7,7 +7,7 @@ if ! command -v sshpass &> /dev/null || ! command -v pv &> /dev/null || ! comman
elif command -v apt-get &> /dev/null; then elif command -v apt-get &> /dev/null; then
sudo apt-get -y install sshpass pv git sudo apt-get -y install sshpass pv git
else else
echo "Package manager not found. Please install sshpass, pv, and git manually" echo -e "\e[31mPackage manager not found. Please install sshpass, pv, and git manually\e[0m"
exit 1 exit 1
fi fi
fi fi
@@ -16,9 +16,10 @@ fi
git clone https://github.com/ION606/VCS.git .ionvcs git clone https://github.com/ION606/VCS.git .ionvcs
# Move files # Move files
sudo mv .ionvcs/ionsrc.desktop /usr/share/applications/ionsrc.desktop || echo "FAILED TO MOVE DESKTOP FILE" sudo mv .ionvcs/ionsrc.desktop /usr/share/applications/ionsrc.desktop || echo -e "\e[31mFAILED TO MOVE DESKTOP FILE\e[0m"
mkdir -p ~/ionsrc mkdir -p ~/ionsrc
mv .ionvcs/* ~/ionsrc/ mv .ionvcs/* ~/ionsrc/
echo "alias ionvcs='bash ~/ionsrc/run.sh'" >> ~/.bashrc
# Clean up # Clean up
rm -rf .ionvcs rm -rf .ionvcs
+1 -1
View File
@@ -15,5 +15,5 @@ echo "password=$password" >> "$CREDSFILE";
# Secure the file # Secure the file
chmod 600 "$CREDSFILE"; chmod 600 "$CREDSFILE";
echo "Logged in!"; echo "Logged in as \033[0;31m$username\e[0m!";
exit; exit;
+3 -3
View File
@@ -4,10 +4,10 @@
cd "$PWD" cd "$PWD"
if [ ! -f "$HOME/ionsrc/creds.txt" ]; then if [ ! -f "$HOME/ionsrc/creds.txt" ]; then
echo "credentials file not found!" echo -e "\e[31mcredentials file not found!\e[0m"
exit 1 exit 1
elif [ ! -f "$PWD/.ionvcs/src.config"]; then elif [ ! -f "$PWD/.ionvcs/src.config"]; then
echo "config file not found!" echo -e "\e[31mconfig file not found!\e[0m"
exit 1 exit 1
fi fi
@@ -38,7 +38,7 @@ DIFF_OUTPUT=$(/usr/bin/sshpass -p "$password" rsync -avcn --delete -e ssh "$REMO
# Check if there are differences # Check if there are differences
if [ ! -z "$DIFF_OUTPUT" && ! $force_flag ]; then if [ ! -z "$DIFF_OUTPUT" && ! $force_flag ]; then
echo "conflicts found between the local and remote directories (make sure they're correct and re-run using the -f flag):" echo -e "\e[31mERROR\e[0m conflicts found between the local and remote directories (make sure they're correct and re-run using the \e[31m-f\e[0m flag):"
echo "$DIFF_OUTPUT" echo "$DIFF_OUTPUT"
exit 1; exit 1;
fi fi
+14 -11
View File
@@ -5,30 +5,33 @@ shift;
case $COMMAND in case $COMMAND in
"clone") "clone")
bash clone.sh "$@" bash $HOME/ionsrc/clone.sh "$@"
;; ;;
"push") "push")
bash push.sh "$@" bash $HOME/ionsrc/push.sh "$@"
;; ;;
"login") "login")
bash login.sh "$@" bash $HOME/ionsrc/login.sh "$@"
;; ;;
"user") "user")
bash getuser.sh bash $HOME/ionsrc/getuser.sh
;; ;;
"status") "status")
bash status.sh bash $HOME/ionsrc/status.sh
;; ;;
"help") "help")
bash help.sh bash $HOME/ionsrc/help.sh
;; ;;
*) *)
echo "UNKNOWN COMMAND \"$@\"" echo "UNKNOWN COMMAND \"$COMMAND\""
GREEN='\033[0;31m'
NC='\033[0m' # No Color
echo -e "use ${GREEN}\`ionvcs help\`${NC} for help"
;; ;;
esac esac
+2 -2
View File
@@ -4,10 +4,10 @@
cd "$PWD" cd "$PWD"
if [ ! -f "$HOME/ionsrc/creds.txt" ]; then if [ ! -f "$HOME/ionsrc/creds.txt" ]; then
echo "credentials file not found!" echo -e "\e[31mcredentials file not found!\e[0m"
exit 1 exit 1
elif [ ! -f "$PWD/.ionvcs/src.config"]; then elif [ ! -f "$PWD/.ionvcs/src.config"]; then
echo "config file not found!" echo -e "\e[31mconfig file not found!\e[0m"
exit 1 exit 1
fi fi