-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargs.liddle
More file actions
executable file
·104 lines (89 loc) · 3.67 KB
/
args.liddle
File metadata and controls
executable file
·104 lines (89 loc) · 3.67 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/scripts/working/Liddle
function processArgs {
argcounter=0
# Move into case for each argument if there is a least one argument
if [ ! ${NEWARGS[0]} == "" ]; then
for arg in ${NEWARGS[@]}
do
case $arg in
# help argument given, display help and exit
"-h" | "help" | "--help")
echo ""
echo "---------------------------------------------------------------------"
echo " LIDDLE SCRIPT "
echo "---------------------------------------------------------------------"
echo ""
echo " Script Description goes here and gives an overview "
echo " of what the script will do"
echo ""
echo " VALID ARGUMENTS "
echo "---------------------------------------------------------------------"
echo ""
echo " -h | --help"
echo " Open the scripts help"
echo ""
echo " -l | --load"
echo " Resume script from prior point"
echo ""
echo " -c | --cleanup"
echo " Clean log file and saved progress file"
echo ""
echo "---------------------------------------------------------------------"
echo ""
core[EXARG]="true"
exit 1
;;
# cleanup argument given, run cleanUp function and quit
"--cleanup" | "--clean" | "-c") cleanUp
core[EXARG]="true"
exit 1 ;;
# resume argument given, restart with logging and ldfile argument
"--load" | "-l") core[EXARG]="true"
loadFile
;;
# If another argument is given but is not a option
*) args[$argcounter]=$arg
core[ARGNUM]="${#args[@]}"
((argcounter++))
;;
esac
done
if [ -e "${core[DIR]}${core[PROGNAME]}.end" ]; then
while :
do
echo ""
echo "A saved progress file exists, would you like to continue from the saved progress?"
read -p "This will ignore added arguments (y/n)" core[CONT]
if [[ "${core[CONT]}" == "y" ]] || [[ "${core[CONT]}" == "Y" ]]; then
loadFile
elif [[ "${core[CONT]}" == "n" ]] || [[ "${core[CONT]}" == "N" ]]; then
break
else
echo "Please input a valid answer (y/n)"
continue
fi
break
done
fi
# Otherwise there are not arguments so check for a save file
else
# If a save file exists
if [ -e "${core[DIR]}${core[PROGNAME]}.end" ]; then
while :
do
echo ""
read -p "A saved progress file exists, would you like to continue from the saved progress? (y/n)" core[CONT]
if [[ ${core[CONT]} == "y" ]] || [[ ${core[CONT]} == "Y" ]]; then
loadFile
elif [[ ${core[CONT]} == "n" ]] || [[ ${core[CONT]} == "N" ]]; then
break
else
echo "Please input a valid answer (y/n)"
continue
fi
break
done
fi
fi
}