Skip to content
Snippets Groups Projects
Commit b110ba12 authored by poulpe's avatar poulpe
Browse files

[Features + Bug] Add global variable for color + Fix error for .gitignore by overwrite file

parent fc3cd2aa
No related branches found
No related tags found
No related merge requests found
...@@ -8,11 +8,17 @@ ACCESS_TOKEN="" ...@@ -8,11 +8,17 @@ ACCESS_TOKEN=""
HTTPS="https://gitedu.hesge.ch" HTTPS="https://gitedu.hesge.ch"
SSH="ssh://git@ssh.hesge.ch:10572" SSH="ssh://git@ssh.hesge.ch:10572"
# Add global var for color
GREEN="\e[32m"
RESET="\e[0m"
BROWN="\e[33m"
RED="\e[31m"
# messages # messages
GITIGNORE_GENERATED="\e[32m.gitignore generated.\e[0m" GITIGNORE_GENERATED= "${GREEN}.gitignore generated.${RESET}"
REPOSITORY_NAME_TAKEN="\e[33mA repository with this name already exists.\e[0m" REPOSITORY_NAME_TAKEN= "${BROWN}A repository with this name already exists.${RESET}"
ARGUMENTS_MISSING="\e[31mArguments are missing.\e[0m" ARGUMENTS_MISSING= "${RED}Arguments are missing.${RESET}"
REPOSITORY_CREATED="\e[32mThe repository is now created with the files of the current folder pushed to it.\e[0m" REPOSITORY_CREATED= "${GREEN}The repository is now created with the files of the current folder pushed to it.${RESET}"
# Display the usage of the script # Display the usage of the script
function d_usage { function d_usage {
...@@ -43,7 +49,7 @@ do ...@@ -43,7 +49,7 @@ do
p) PUBLIC=${OPTARG};; p) PUBLIC=${OPTARG};;
m) METHOD=${OPTARG};; m) METHOD=${OPTARG};;
\?) \?)
echo -e "\e[31m-${OPTARG} is not a valid option.\e[0m" echo -e "${RED}-${OPTARG} is not a valid option.${RESET}"
d_usage d_usage
exit;; exit;;
esac esac
...@@ -89,9 +95,9 @@ fi ...@@ -89,9 +95,9 @@ fi
# Create a .gitignore specific to a c program # Create a .gitignore specific to a c program
touch .gitignore touch .gitignore
echo "*" > .gitignore echo "*" > .gitignore
echo "!*.*" > .gitignore echo "!*.*" >> .gitignore
echo "!Makefile" > .gitignore echo "!Makefile" >> .gitignore
echo "*.o" > .gitignore echo "*.o" >> .gitignore
# Initialize a local repository and push the files # Initialize a local repository and push the files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment