-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·74 lines (56 loc) · 1.77 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·74 lines (56 loc) · 1.77 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
#!/bin/bash
set -e
show_help() {
echo "Usage: ./run.sh [OPTIONS]"
echo ""
echo "Options:"
echo " --help Show this help message"
echo ""
echo "Application usage examples:"
echo " ./typi Start a typing test with default number of words"
echo " ./typi -n 10 Start a typing test with 10 words"
echo " ./typi -n 50 Start a typing test with 50 words"
echo " ./typi -sp Show typing progress"
echo " ./typi -h Show application help message"
echo ""
echo "Note: Run this script from the project root directory."
}
check_dependencies() {
local missing_deps=()
command -v cmake >/dev/null 2>&1 || missing_deps+=("cmake")
command -v make >/dev/null 2>&1 || missing_deps+=("make")
command -v g++ >/dev/null 2>&1 || missing_deps+=("g++")
command -v gnuplot >/dev/null 2>&1 || missing_deps+=("gnuplot")
if [ ${#missing_deps[@]} -ne 0 ]; then
echo "Error: Missing dependencies: ${missing_deps[*]}"
echo "Install them using your package manager, e.g.:"
echo " sudo pacman -S ${missing_deps[*]}"
exit 1
fi
echo "All dependencies are installed."
}
if [ "$1" = "--help" ]; then
show_help
exit 0
fi
check_dependencies
mkdir -p ~/typi
mkdir -p build
cd build
# Configure the project with CMake
cmake ..
# Build the project
make
# move the executable to /usr/local/bin
sudo cp typi /usr/local/bin
# Run the executable
# Example: Start a typing test with default number of words
./typi
# Example: Start a typing test with 10 words
# ./typi -n 10
# Example: Start a typing test with 50 words
# ./typi -n 50
# Example: Show typing progress
# ./typi -sp
# Example: Show help message
# ./typi -h