updated project 2

This commit is contained in:
Hugh Ratsch
2025-02-09 03:28:16 -06:00
parent 33a43b7ec5
commit 43e9e28908
+28
View File
@@ -229,6 +229,17 @@ print_help_menu() {
echo -e "- Use arrow keys for command history" echo -e "- Use arrow keys for command history"
} }
# Function to get challenge description
get_challenge_description() {
local challenge_id=$1
if [[ -n "${CHALLENGES[$challenge_id]:-}" ]]; then
IFS='|' read -r _ _ _ _ task _ _ _ <<< "${CHALLENGES[$challenge_id]}"
echo "$task"
else
echo "Challenge not found"
fi
}
# Function to print challenge header # Function to print challenge header
print_challenge_header() { print_challenge_header() {
local challenge_id=$1 local challenge_id=$1
@@ -248,6 +259,23 @@ setup_challenge_env() {
return 0 return 0
} }
# Function to source required scripts
source_required_scripts() {
local required_scripts=(common.sh challenges.sh)
for script in "${required_scripts[@]}"; do
if ! source "$CHALLENGE_DIR/.tracking/$script" 2>/dev/null; then
echo -e "${RED}Error: Required script not found: $script${NC}"
echo -e "${YELLOW}Running setup first...${NC}"
setup_environment
if ! source "$CHALLENGE_DIR/.tracking/$script" 2>/dev/null; then
echo -e "${RED}Error: Failed to source $script even after setup${NC}"
return 1
fi
fi
done
return 0
}
# Function to start a challenge # Function to start a challenge
start_challenge() { start_challenge() {
local challenge_id=$1 local challenge_id=$1