updated project 2
This commit is contained in:
@@ -229,6 +229,17 @@ print_help_menu() {
|
||||
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
|
||||
print_challenge_header() {
|
||||
local challenge_id=$1
|
||||
@@ -248,6 +259,23 @@ setup_challenge_env() {
|
||||
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
|
||||
start_challenge() {
|
||||
local challenge_id=$1
|
||||
|
||||
Reference in New Issue
Block a user