├── Cpp_OrthodoxGenerator.sh ├── Installer.sh ├── README.md └── src ├── Screen_Shot_2022-12-06_at_3.53.23_PM.png ├── Screen_Shot_2022-12-06_at_4.01.02_PM.png ├── Screen_Shot_2022-12-06_at_4.05.59_PM 1.png ├── Screen_Shot_2022-12-06_at_4.05.59_PM.png ├── Screen_Shot_2022-12-06_at_4.58.39_PM.png └── Usage.png /Cpp_OrthodoxGenerator.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | printf "\n" 4 | printf "░█████╗░██████╗░██████╗░  ░██████╗░███████╗███╗░░██╗ 5 | ██╔══██╗██╔══██╗██╔══██╗  ██╔════╝░██╔════╝████╗░██║ 6 | ██║░░╚═╝██████╔╝██████╔╝  ██║░░██╗░█████╗░░██╔██╗██║ 7 | ██║░░██╗██╔═══╝░██╔═══╝░  ██║░░╚██╗██╔══╝░░██║╚████║ 8 | ╚█████╔╝██║░░░░░██║░░░░░  ╚██████╔╝███████╗██║░╚███║ 9 | ░╚════╝░╚═╝░░░░░╚═╝░░░░░  ░╚═════╝░╚══════╝╚═╝░░╚══╝\033[m\n" 10 | 11 | printf "\n By : \x1b[33mmarbenMB\033[m [mbenbajj]\n" 12 | echo "" 13 | 14 | echo -n "Current Directory : " 15 | pwd 16 | 17 | #Variables 18 | PATH="" 19 | CLASS="" 20 | OPTION="" 21 | 22 | #PATH 23 | echo "*******************************************************" 24 | echo -ne "\x1b[33mEnter Path Of Creation : \033[m" 25 | read PATH 26 | 27 | if [ -d $PATH ] &> /dev/null 28 | then 29 | cd $PATH 30 | echo "Changing Directory to : " $PATH 31 | echo "*******************************************************" 32 | echo -ne "\x1b[33mEnter Class Name : \033[m" 33 | read CLASS 34 | if [ $CLASS != "" ] 2> /dev/null 35 | then 36 | echo "Class Name : " $CLASS 37 | echo "*******************************************************" 38 | /usr/bin/touch $CLASS.cpp $CLASS.hpp 39 | 40 | # *** Printing To Class.hpp *** 41 | 42 | echo "#ifndef _"$CLASS"_HPP_" >> $CLASS.hpp 43 | echo "#define _"$CLASS"_HPP_" >> $CLASS.hpp 44 | printf "\n" >> $CLASS.hpp 45 | echo "#include " >> $CLASS.hpp 46 | printf "\n" >> $CLASS.hpp 47 | 48 | echo "// ******************************************************** //" >> $CLASS.hpp 49 | echo "// CLASSES //" >> $CLASS.hpp 50 | echo "// ****************************************************** //" >> $CLASS.hpp 51 | 52 | printf "\nclass $CLASS 53 | { 54 | public : 55 | $CLASS (); 56 | $CLASS ($CLASS const &obj); 57 | ~$CLASS (); 58 | $CLASS &operator= (const $CLASS &obj); 59 | 60 | private : 61 | // DataType attributes. 62 | };\n\n" >> $CLASS.hpp 63 | 64 | printf "// ******************************************************** // 65 | // FUNCTIONS // 66 | // ****************************************************** //\n\n" >> $CLASS.hpp 67 | 68 | echo "#endif" >> $CLASS.hpp 69 | 70 | # *** Printing To Class.cpp *** 71 | 72 | printf "#include \"$CLASS.hpp\" 73 | 74 | $CLASS::$CLASS() 75 | { 76 | std::cout << \"$CLASS : Default Constructor Called\" << std::endl; 77 | } 78 | 79 | $CLASS::~$CLASS() 80 | { 81 | std::cout << \"$CLASS : Destructor Called\" << std::endl; 82 | } 83 | 84 | $CLASS::$CLASS($CLASS const &obj) 85 | { 86 | std::cout << \"Copy Constructor Called\" << std::endl; 87 | if (this != &obj) 88 | *this = obj; 89 | } 90 | 91 | $CLASS &$CLASS::operator= (const $CLASS &obj) 92 | { 93 | std::cout << \"Copy Assignment Operator Called\" << std::endl; 94 | if (this != &obj) 95 | { 96 | // this->attributes = obj.attributes; 97 | // ... 98 | } 99 | return (*this); 100 | }\n" > $CLASS.cpp 101 | 102 | echo -ne "\x1b[33mCreate main.cpp and Makefile \033[m[\x1b[32my\033[m/\x1b[31mn\033[m] : " 103 | read OPTION 104 | if [ $OPTION == "y" ] || [ $OPTION == "yes" ] &> /dev/null 105 | then 106 | /usr/bin/touch main.cpp Makefile 107 | # *** Printing To Makefile *** 108 | 109 | printf "NAME = $CLASS \n 110 | CXXFLAGS = -Wall -Wextra -Werror -fsanitize=address\n 111 | CC = c++ \n 112 | STD = -std=c++98 \n 113 | SRC = $CLASS.cpp main.cpp \n 114 | INC = $CLASS.hpp \n 115 | OBJ = \$(SRC:.cpp=.o) \n 116 | all : \$(NAME) \n 117 | \$(NAME) : \$(OBJ) 118 | \$(CC) \$(CXXFLAGS) \$(STD) \$(OBJ) -o \$(NAME) \n\n" >> Makefile 119 | 120 | echo %.o : %.cpp "\$(INC)" >> Makefile 121 | printf " \$(CC) \$(CXXFLAGS) -c \$< -o \$@ \n 122 | clean : 123 | rm -rf \$(OBJ) \n 124 | fclean : clean 125 | rm -rf \$(NAME) \n 126 | re : fclean all \n 127 | .PHONY : all clean fclean re\n" >> Makefile 128 | 129 | # *** Printing To main.cpp *** 130 | 131 | printf "#include \"$CLASS.hpp\"\n 132 | int main() 133 | { 134 | // You Code\n 135 | std::cout << \"****** MAR_BEN CREATION √ ******\" << std::endl;\n 136 | return (0); 137 | }\n" > main.cpp 138 | fi 139 | printf "\n░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 140 | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 141 | █████╗█████╗█████╗█████╗█████╗█████╗█████╗ 142 | ╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝ 143 | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 144 | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n\n" 145 | echo -e "\x1b[32m+> " $CLASS " : Files Created !\033[m\n" 146 | else 147 | echo -e "______________________________________\n" 148 | echo -e "\x1b[31mNo Class Name Entred\033[m\n" 149 | fi 150 | else 151 | echo -e "______________________________________\n" 152 | echo -e "\x1b[31m*** $PATH : ** Path not found !! **\033[m\n" 153 | fi 154 | -------------------------------------------------------------------------------- /Installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # *********************** # 4 | # Functions Definitions : 5 | # *********************** # 6 | 7 | pulling () { 8 | loading & 9 | pid=$! 10 | git pull 1> /dev/null 11 | sleep 2 12 | pullCheck 13 | kill $pid 14 | wait $pid 2>/dev/null 15 | echo "" 16 | } 17 | 18 | loading () { 19 | 20 | echo "" 21 | echo -n " " 22 | while [ 1 ] 23 | do 24 | echo -ne "█" 25 | sleep 0.1 26 | done 27 | } 28 | 29 | pullCheck () { 30 | printf "\n\n" 31 | if [ $? == "0" ] 32 | then 33 | echo -e " \x1b[32m ... Update DONE ... \033[m" 34 | else 35 | echo -e " \x1b[31m ... Update FAILED ... \033[m" 36 | fi 37 | } 38 | 39 | # *********************** # 40 | # Header Printing : 41 | # *********************** # 42 | 43 | printf "\n" 44 | printf "░█████╗░██████╗░██████╗░  ░██████╗░███████╗███╗░░██╗ 45 | ██╔══██╗██╔══██╗██╔══██╗  ██╔════╝░██╔════╝████╗░██║ 46 | ██║░░╚═╝██████╔╝██████╔╝  ██║░░██╗░█████╗░░██╔██╗██║ 47 | ██║░░██╗██╔═══╝░██╔═══╝░  ██║░░╚██╗██╔══╝░░██║╚████║ 48 | ╚█████╔╝██║░░░░░██║░░░░░  ╚██████╔╝███████╗██║░╚███║ 49 | ░╚════╝░╚═╝░░░░░╚═╝░░░░░  ░╚═════╝░╚══════╝╚═╝░░╚══╝\033[m\n" 50 | 51 | printf "\n By : \x1b[33mmarbenMB\033[m [mbenbajj]\n" 52 | echo "" 53 | echo "------------------------------------------------------" 54 | printf " Usage Command : \x1b[32mCppGen\033[m\n" 55 | echo "------------------------------------------------------" 56 | 57 | # *********************** # 58 | # Command Installation : 59 | # *********************** # 60 | 61 | echo "" 62 | echo -e " \x1b[32m ... Installation ... \033[m" 63 | echo -e " \x1b[33m ..... Updating ..... \033[m" 64 | 65 | pulling 66 | 67 | # *********************** # 68 | # Command Existance : 69 | # *********************** # 70 | 71 | cat ~/.zshrc | grep -c CppGen 1> /dev/null 72 | 73 | if [ $? == "1" ] 74 | then 75 | cp Cpp_OrthodoxGenerator.sh ~ 76 | echo "alias CppGen='bash ~/Cpp_OrthodoxGenerator.sh'" >> ~/.zshrc 77 | 78 | if [ $? == "0" ] 79 | then 80 | echo -e " \x1b[32mInstallation DONE :D\033[m" 81 | else 82 | echo -e " \x1b[31m Installation FAILED \033[m" 83 | fi 84 | else 85 | echo -e " \x1b[33mAlready Installed :D \033[m" 86 | fi 87 | echo "" 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cpp Orthodox Generator Script 2 | 3 | ### Created by : [marbenMB](https://github.com/marbenMB) 4 | 5 | --- 6 | 7 | ## Purpose : 8 | 9 | - This Scripts generates files (.cpp , .hpp , Makefile…) for a c++ class designed in Orthodox Canonical Form. 10 | 11 | ![Screen Shot 2022-12-06 at 4.05.59 PM.png](src/Screen_Shot_2022-12-06_at_4.05.59_PM.png) 12 | 13 | ## Installation : 14 | 15 | - Execute this line of command in your terminal : 16 | 17 | ```jsx 18 | cd && git clone https://github.com/marbenMB/Cpp-Orthodox-Generator-Script.git 19 | ``` 20 | 21 | - The Script will be cloned to the Home directory : 22 | 23 | ```jsx 24 | cd ~ 25 | ``` 26 | 27 | - Get in the script directory : 28 | 29 | ```jsx 30 | cd Cpp-Orthodox-Generator-Script 31 | ``` 32 | 33 | - Then run the Installer script : 34 | 35 | ```jsx 36 | ./Installer.sh 37 | ``` 38 | 39 | ![Screen Shot 2022-12-06 at 4.01.02 PM.png](src/Screen_Shot_2022-12-06_at_4.01.02_PM.png) 40 | 41 | - The script will be installed Successfully. 42 | 43 | ## Usage : 44 | 45 | - For Usage now use `CppGen` command instead of running the script every time: 46 | 47 | ```jsx 48 | CppGen 49 | ``` 50 | 51 | - Where ever you are located the script will works using this command. 52 | 53 | ![Usage.png](src/Usage.png) 54 | 55 | - Then You will find the files where you choose to create. 56 | 57 | ![Screen Shot 2022-12-06 at 3.53.23 PM.png](src/Screen_Shot_2022-12-06_at_3.53.23_PM.png) 58 | 59 | ![Screen Shot 2022-12-06 at 4.05.59 PM.png](src/Screen_Shot_2022-12-06_at_4.05.59_PM%201.png) 60 | 61 | 🔴 If There is some issues with script : 62 | 63 | - run : `vim ~/.zshrc` and delete the line of CppGen alias 64 | 65 | ![Screen Shot 2022-12-06 at 4.58.39 PM.png](src/Screen_Shot_2022-12-06_at_4.58.39_PM.png) 66 | 67 | - Then install again by running the installer script : `./Installer.sh` 68 | -------------------------------------------------------------------------------- /src/Screen_Shot_2022-12-06_at_3.53.23_PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marbenMB/Cpp-Orthodox-Generator-Script/2ccd6ef1624add95d69cd59b8229e3af11ef64c7/src/Screen_Shot_2022-12-06_at_3.53.23_PM.png -------------------------------------------------------------------------------- /src/Screen_Shot_2022-12-06_at_4.01.02_PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marbenMB/Cpp-Orthodox-Generator-Script/2ccd6ef1624add95d69cd59b8229e3af11ef64c7/src/Screen_Shot_2022-12-06_at_4.01.02_PM.png -------------------------------------------------------------------------------- /src/Screen_Shot_2022-12-06_at_4.05.59_PM 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marbenMB/Cpp-Orthodox-Generator-Script/2ccd6ef1624add95d69cd59b8229e3af11ef64c7/src/Screen_Shot_2022-12-06_at_4.05.59_PM 1.png -------------------------------------------------------------------------------- /src/Screen_Shot_2022-12-06_at_4.05.59_PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marbenMB/Cpp-Orthodox-Generator-Script/2ccd6ef1624add95d69cd59b8229e3af11ef64c7/src/Screen_Shot_2022-12-06_at_4.05.59_PM.png -------------------------------------------------------------------------------- /src/Screen_Shot_2022-12-06_at_4.58.39_PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marbenMB/Cpp-Orthodox-Generator-Script/2ccd6ef1624add95d69cd59b8229e3af11ef64c7/src/Screen_Shot_2022-12-06_at_4.58.39_PM.png -------------------------------------------------------------------------------- /src/Usage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marbenMB/Cpp-Orthodox-Generator-Script/2ccd6ef1624add95d69cd59b8229e3af11ef64c7/src/Usage.png --------------------------------------------------------------------------------