@@ -90,7 +90,6 @@ run() {
9090
9191 if [[ ${FILE#* .} == c ]]; then
9292 " ${CC:= gcc} " ${CFLAGS} " $FILE " -o " ${FILE%% .* } .out"
93-
9493 if [[ $DEBUG == true ]]; then
9594 " $debugger " " ${FILE%% .* } .out"
9695 if [[ $PERSISTENT != true ]]; then
@@ -101,13 +100,12 @@ run() {
101100 ./" ${FILE%% .* } .out"
102101 fi
103102 fi
104-
105103 if [[ $PERSISTENT != true ]]; then
106104 rm -rf ./" ${FILE%% .* } .out"
107105 fi
106+
108107 elif [[ ${FILE#* .} == cpp ]]; then
109108 " ${CXX:= g++} " ${CFLAGS} " $FILE " -o " ${FILE%% .* } .out"
110-
111109 if [[ $DEBUG == true ]]; then
112110 " $debugger " " ${FILE%% .* } .out"
113111 if [[ $PERSISTENT != true ]]; then
@@ -118,15 +116,14 @@ run() {
118116 ./" ${FILE%% .* } .out"
119117 fi
120118 fi
121-
122119 if [[ $PERSISTENT != true ]]; then
123120 rm -rf ./" ${FILE%% .* } .out"
124121 fi
122+
125123 elif [[ ${FILE#* .} == py ]]; then
126124 if [[ $pyv == " " ]]; then
127125 # # Default will be python2.
128126 COMPILED=" ${FILE%% .* } .pyc"
129-
130127 python2 -m py_compile " $FILE " 2> /dev/null
131128 if [[ ! -f $COMPILED ]]; then
132129 py=" python3"
@@ -145,23 +142,22 @@ run() {
145142 dpyv=2
146143 fi
147144 fi
148-
149145 echo " ${yellow} >> Using python $dpyv ${white} "
150146 if [[ $COMPILE == true ]]; then
151147 " $py " -m py_compile " $FILE " 2> /dev/null
152148 else
153149 " $py " " $FILE "
154150 fi
151+
155152 elif [[ ${FILE#* .} == rs ]]; then
156153 rustc " $FILE " -o " ${FILE%% .* } .out"
157-
158154 if [[ $COMPILE != true ]]; then
159155 ./" ${FILE%% .* } .out"
160156 fi
161-
162157 if [[ $PERSISTENT != true ]]; then
163158 rm -rf ./" ${FILE%% .* } .out"
164159 fi
160+
165161 else
166162 _ERROR_UFTC_
167163 _EXIT_
174170
175171for arg in " $@ " ; do
176172 case $arg in
177-
178173 " -h" | " --help" )
179174 echo " $USAGE " && exit 0
180175 ;;
181- * " .c" | * " .cpp" | * " .py" | * " .rs" )
176+ * " .c" | * " .cpp" | * " .py" | * " .rs" | * " .java " )
182177 FILE_LOCATION=$arg
183178 if [[ ! -f $FILE_LOCATION ]]; then
184179 _ERROR_UFTC_
185180 _EXIT_
186181 fi
187-
188182 if [[ $FILE_LOCATION != * /* ]]; then
189183 FILE=$FILE_LOCATION
190184 run
@@ -200,7 +194,6 @@ for arg in "$@"; do
200194 if [[ -z $c ]]; then
201195 echo " ${red} ERROR: ${white} No arguments given to --cc/-c"
202196 echo " ${cyan} USAGE: ${white} --cc/-c=gcc/clang"
203-
204197 _EXIT_
205198 else
206199 export CC=$c
@@ -212,7 +205,6 @@ for arg in "$@"; do
212205 if [[ -z $cx ]]; then
213206 echo " ${red} ERROR: ${white} No arguments given to --cxx"
214207 echo " ${cyan} USAGE: ${white} --cxx=g++/clang++"
215-
216208 _EXIT_
217209 else
218210 export CXX=$cx
@@ -223,7 +215,6 @@ for arg in "$@"; do
223215 pyv=${arg#* =}
224216 if [ " $pyv " != 3 ] && [ " $pyv " != 2 ]; then
225217 echo " ${red} ERROR: ${white} Expected versions for python are 2 and 3"
226-
227218 _EXIT_
228219 fi
229220 ;;
0 commit comments