updated project 2
This commit is contained in:
@@ -40,14 +40,22 @@ show_spinner() {
|
|||||||
print_banner() {
|
print_banner() {
|
||||||
clear
|
clear
|
||||||
cat << "EOF"
|
cat << "EOF"
|
||||||
_____ _
|
______ __ __ _
|
||||||
| |___ _____ _____ ___ ___ _____ ___ | |
|
/ ____/___ ____ ___ ____ ___ ____ _____ ___/ / / / (_)___ ___
|
||||||
| --| . | | | .'| | | . ||_|
|
/ / / __ \/ __ `__ \/ __ `__ \/ __ `/ __ \/ __ / / / / / __ \/ _ \
|
||||||
|_____|___|_|_|_|_|_|_|__,|_|_|_|_|_| |
|
/ /___/ /_/ / / / / / / / / / / / /_/ / / / / /_/ / / /___/ / / / / __/
|
||||||
|___|
|
\____/\____/_/ /_/ /_/_/ /_/ /_/\__,_/_/ /_/\__,_/ /_____/_/_/ /_/\___/
|
||||||
|
|
||||||
|
__ ___ __ ________ ____
|
||||||
|
/ |/ /___ ______/ /____ _______ __ / ____/ /_ ___/ / /__ ____
|
||||||
|
/ /|_/ / __ `/ ___/ __/ _ \/ ___/ / / / / / / __ \/ __ / / _ \/ __ \
|
||||||
|
/ / / / /_/ (__ ) /_/ __/ / / /_/ / / /___/ / / / /_/ / / __/ / / /
|
||||||
|
/_/ /_/\__,_/____/\__/\___/_/ \__, / \____/_/ /_/\__,_/_/\___/_/ /_/
|
||||||
|
/____/
|
||||||
EOF
|
EOF
|
||||||
echo -e "${BOLD}Command Line Mastery Challenge${NC}"
|
echo -e "\n${BOLD}Welcome to the Command Line Mastery Challenge!${NC}"
|
||||||
echo "=============================="
|
echo -e "${BLUE}Test your Linux command-line skills with interactive challenges${NC}"
|
||||||
|
echo "=============================================================="
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to check if command exists
|
# Function to check if command exists
|
||||||
@@ -252,11 +260,31 @@ print_challenge_header() {
|
|||||||
setup_challenge_env() {
|
setup_challenge_env() {
|
||||||
local challenge_id=$1
|
local challenge_id=$1
|
||||||
echo -e "${BLUE}Setting up challenge files...${NC}"
|
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 "${RED}Error: Failed to setup challenge environment${NC}"
|
||||||
echo -e "${YELLOW}Try running: $0 clean && $0 setup${NC}"
|
echo -e "${YELLOW}Try running: $0 clean && $0 setup${NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
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
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,6 +345,10 @@ start_challenge() {
|
|||||||
bind 'set completion-ignore-case on' 2>/dev/null || true
|
bind 'set completion-ignore-case on' 2>/dev/null || true
|
||||||
bind 'set show-all-if-ambiguous 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
|
# Start command loop with improved prompt
|
||||||
local cmd_count=0
|
local cmd_count=0
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
Reference in New Issue
Block a user