-
Notifications
You must be signed in to change notification settings - Fork 788
/
python
executable file
·33 lines (26 loc) · 1.04 KB
/
python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
BLUE='\033[1;34m'
NC='\033[0m'
if [[ "$@" == *"-i"* ]] || [[ "$@" == *"--interactive"* ]] || [[ "$@" == "" ]]; then
echo -e "${BLUE}You are running Python in interactive mode."
echo "To run another program after this one, run:"
echo -e " ${NC}exit()${BLUE}"
echo -e "Do the same thing if you run into weird errors.${NC}"
echo
$HOME/$REPL_SLUG/venv/bin/python $@
elif [[ "$@" == *"loops"* ]]; then
timeout 5 $HOME/$REPL_SLUG/venv/bin/python $@
if [[ $? == 124 ]]; then
echo -e "${BLUE}Your program took quite a while to run."
echo "So I've stopped it for you."
echo "You can try running it again if you like."
echo
echo "If you're on the 'while' material, you're probably"
echo " causing an infinite loop."
echo "Check that your condition is right, and that you're"
echo -e " adding 1 to your counter variable.${NC}"
fi
else
echo -e "${BLUE}If you need to force-quit this program, press Ctrl+C.${NC}"
$HOME/$REPL_SLUG/venv/bin/python $@
fi