Files

45 lines
1.4 KiB
Bash
Raw Permalink Normal View History

2025-02-09 02:01:58 -06:00
#!/bin/bash
2025-02-09 02:10:26 -06:00
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CHALLENGE_DIR=~/challenge
# Source from tracking directory where scripts are copied
source "$CHALLENGE_DIR/.tracking/common.sh"
source "$CHALLENGE_DIR/.tracking/challenges.sh"
2025-02-09 02:01:58 -06:00
# Function to start a challenge
start_challenge() {
local challenge_id=$1
# Clear screen and show welcome message
clear
echo -e "${BOLD}🎮 Command Line Mastery Challenge${NC}"
echo "=============================="
# Show challenge details
get_challenge_details "$challenge_id"
# Initialize challenge environment
echo -e "\n${BLUE}Setting up challenge environment...${NC}"
2025-02-09 02:10:26 -06:00
bash "$CHALLENGE_DIR/.tracking/level1-setup.sh"
2025-02-09 02:01:58 -06:00
# Record start time
local start_time=$(date +%s)
2025-02-09 02:10:26 -06:00
mkdir -p "$(dirname "$CHALLENGE_DIR/.tracking/current_challenge")"
2025-02-09 02:01:58 -06:00
echo "$challenge_id,$start_time" > "$CHALLENGE_DIR/.tracking/current_challenge"
echo -e "\n${GREEN}Challenge environment ready!${NC}"
echo -e "Type ${YELLOW}verify-challenge${NC} when you're ready to check your solution"
echo -e "Type ${YELLOW}show-hint${NC} if you need help"
echo -e "Type ${YELLOW}show-progress${NC} to see your progress\n"
}
# Main execution
if [[ $# -eq 0 ]]; then
echo "Usage: $0 <challenge-id>"
echo "Available challenges:"
list_challenges
exit 1
fi
start_challenge "$1"