updated project 2

This commit is contained in:
Hugh Ratsch
2025-02-09 03:43:33 -06:00
parent 872ddd766b
commit 6f8846ee95
+40 -8
View File
@@ -40,14 +40,22 @@ show_spinner() {
print_banner() {
clear
cat << "EOF"
_____ _
| |___ _____ _____ ___ ___ _____ ___ | |
| --| . | | | .'| | | . ||_|
|_____|___|_|_|_|_|_|_|__,|_|_|_|_|_| |
|___|
______ __ __ _
/ ____/___ ____ ___ ____ ___ ____ _____ ___/ / / / (_)___ ___
/ / / __ \/ __ `__ \/ __ `__ \/ __ `/ __ \/ __ / / / / / __ \/ _ \
/ /___/ /_/ / / / / / / / / / / / /_/ / / / / /_/ / / /___/ / / / / __/
\____/\____/_/ /_/ /_/_/ /_/ /_/\__,_/_/ /_/\__,_/ /_____/_/_/ /_/\___/
__ ___ __ ________ ____
/ |/ /___ ______/ /____ _______ __ / ____/ /_ ___/ / /__ ____
/ /|_/ / __ `/ ___/ __/ _ \/ ___/ / / / / / / __ \/ __ / / _ \/ __ \
/ / / / /_/ (__ ) /_/ __/ / / /_/ / / /___/ / / / /_/ / / __/ / / /
/_/ /_/\__,_/____/\__/\___/_/ \__, / \____/_/ /_/\__,_/_/\___/_/ /_/
/____/
EOF
echo -e "${BOLD}Command Line Mastery Challenge${NC}"
echo "=============================="
echo -e "\n${BOLD}Welcome to the Command Line Mastery Challenge!${NC}"
echo -e "${BLUE}Test your Linux command-line skills with interactive challenges${NC}"
echo "=============================================================="
}
# Function to check if command exists
@@ -252,11 +260,31 @@ print_challenge_header() {
setup_challenge_env() {
local challenge_id=$1
echo -e "${BLUE}Setting up challenge files...${NC}"
if ! bash "$CHALLENGE_DIR/.tracking/level1-setup.sh"; then
# Source the setup script instead of executing it
if ! source "$CHALLENGE_DIR/.tracking/level1-setup.sh"; then
echo -e "${RED}Error: Failed to setup challenge environment${NC}"
echo -e "${YELLOW}Try running: $0 clean && $0 setup${NC}"
return 1
fi
# Run the setup function from the sourced script
if ! init_environment; then
echo -e "${RED}Error: Failed to initialize environment${NC}"
return 1
fi
if ! setup_file_challenges; then
echo -e "${RED}Error: Failed to setup file challenges${NC}"
return 1
fi
if ! setup_permission_challenges; then
echo -e "${RED}Error: Failed to setup permission challenges${NC}"
return 1
fi
echo -e "${GREEN}Challenge environment ready!${NC}"
return 0
}
@@ -317,6 +345,10 @@ start_challenge() {
bind 'set completion-ignore-case on' 2>/dev/null || true
bind 'set show-all-if-ambiguous on' 2>/dev/null || true
echo -e "\n${YELLOW}Your challenge environment is ready!${NC}"
echo -e "You can use the following commands:"
print_help_menu
# Start command loop with improved prompt
local cmd_count=0
while true; do