-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdev
More file actions
executable file
·50 lines (39 loc) · 1.11 KB
/
dev
File metadata and controls
executable file
·50 lines (39 loc) · 1.11 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
#!/bin/bash
# To view the license please visit https://github.com/IDNI/parser/blob/main/LICENSE.md
echo "dev - Tau Parser development helper scripts"
help() {
echo "Usage: ./dev <SCRIPT> <SCRIPT_OPTIONS>"
echo "Available scripts:"
for script in scripts/*.sh; do
if [ -f "$script" ]; then
echo -e "\t$(basename "$script" .sh)"
fi
done
echo "For more information, see scripts/README.md"
}
error() {
echo -e "\nError: $1\n"
help
exit 1
}
# Check if first argument is provided
if [ $# -eq 0 ]; then
error "No script name provided"
fi
script_name="$1"
if [ "$script_name" == "help" ] || [ "$script_name" == "--help" ] || [ "$script_name" == "-h" ]; then
help
exit 0
fi
script_name="${script_name%.sh}" # remove .sh extension if provided
script_path=""
# Check if script exists (script must have .sh extension)
if [ -f "scripts/${script_name}.sh" ]; then
script_path="scripts/${script_name}.sh"
else
error "'scripts/${script_name}.sh' not found"
fi
echo "Running: $script_path"
# Execute the script and pass all remaining arguments
shift # Remove the first argument (script name)
exec "$script_path" "$@"