aboutsummaryrefslogtreecommitdiff
path: root/project/QBarInterpreter/qbar.sh
blob: 1b150f762496286c8b79076896de08f57fb6b228 (plain) (blame)
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
33
34
35
36
#!/bin/sh
interpret=0;

is_interpreted() {
	for i in $@ ; do
		if [ "$i" == "-i" ] ; then
			interpret=1;
			break
		fi
	done;
}

is_interpreted;

if [ $interpret ] ; then
	qb_dir=/home/`whoami`/
	if [ ! -e $qb_dir ] ; then
		history="";
	else
		qb_dir=$qb_dir/.qbar
		if [ ! -e $qb_dir ] ; then
			mkdir $qb_dir
		fi

		qb_hist_file=$qb_dir/qb_history
		if [ ! -e $qb_hist_file ] ; then
			touch $qb_hist_file
		fi

		history="-H $qb_hist_file"
	fi

	rlwrap $history -c -f /usr/lib/qbar/aux/completions.txt java -jar /usr/lib/qbar/lib/QBarInterpreter.jar -p /usr/lib/qbar $@
else
	java -jar /usr/lib/qbar/lib/QBarInterpreter.jar -p /usr/lib/qbar $@
fi