-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathalgchoice
More file actions
52 lines (49 loc) · 1.83 KB
/
algchoice
File metadata and controls
52 lines (49 loc) · 1.83 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Save/restore various lists of algorithms in AIA implementation to/from
# other files. Aim is to easily create a version of AIA that is less
# bloated, for development purposes. Eg, you can save the complete list
# of algorithms, create a version that has just a couple of algorithms
# you might be working on, develop them, then restore the original
# algorithm list. Maybe it will make the system a bit less of a beast
# and easier to run on ancient machines such as mine...
# Currently seems to need heapsort (default alg) and union find
# explanation (due to import somewhere?)
# eslint causes some problems because it seems to look at all the .js
# files, not just the ones used - best use -no-verify in commits etc
algfiles=(
src/algorithms/masterList.js
src/algorithms/controllers/index.js
src/algorithms/instructions/index.js
src/algorithms/explanations/index.js
src/algorithms/parameters/index.js
src/algorithms/extra-info/index.js
src/algorithms/pseudocode/index.js
)
if test $# -ne 2 || (test "$1" != "-s" && test "$1" != "-r" && test "$1" != "-c" )
then
echo 'Usage: algchoice -[s,r,c] label'
echo 'Saves/restores files containing lists of algorithms to/from files'
echo 'named algchoice_label. algchoice -s saves and algchoice -r restores.'
echo 'algchoice -c cleans up files used for saving.'
echo 'The relevant files are as follows:'
for f in "${algfiles[@]}"; do
echo $f
done
echo 'Current saved files:'
(cd src/algorithms; ls algchoice_*)
exit 1
elif test "$1" = "-s"
then
for f in "${algfiles[@]}"; do
cp $f $(dirname "$f")/algchoice_$2
done
elif test "$1" = "-r"
then
for f in "${algfiles[@]}"; do
cp $(dirname "$f")/algchoice_$2 $f
done
else
for f in "${algfiles[@]}"; do
rm $(dirname "$f")/algchoice_$2
done
fi