-
Notifications
You must be signed in to change notification settings - Fork 0
/
format.sh
45 lines (38 loc) · 944 Bytes
/
format.sh
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
#!/bin/bash
#
# fbctf formatting script
#
# Usage: format.sh [-h|--help] [ARGUMENT]
#
# Parameters:
# -h, --help Shows this help message and exit.
#
# Optional Parameters:
# PATH Path to fbctf code.
SRC_LOCATION="/vagrant/src"
IGNORE_FILES=("language/language.php")
function usage() {
printf "\nfbctf formatting script\n"
printf "\nUsage: %s [-h|--help] [ARGUMENT] \n" "${0}"
printf "\nParameters:\n"
printf " -h, --help \t\tShows this help message and exit.\n"
printf "\nOptional Arguments:\n"
printf " PATH \tPath to fbctf code.\n"
}
if [[ "$1" == "-h" || "$1" == "--help" ]]
then
usage
exit 0
elif [[ -n "$1" ]]
then
SRC_LOCATION="$1"
fi
for file in "${IGNORE_FILES[@]}"; do
fullpath="$SRC_LOCATION/$file"
mv "$fullpath" "$fullpath.back"
done
hh_format "$SRC_LOCATION"
for file in "${IGNORE_FILES[@]}"; do
fullpath="$SRC_LOCATION/$file"
mv "$fullpath.back" "$fullpath"
done