#!/bin/bash set -e set -o pipefail # Parse arguments FORCE=false while [[ $# -gt 0 ]]; do case $1 in --force) FORCE=true shift ;; -h|--help) echo "Usage: $0 [--force]" echo "" echo "Copy Wild Cloud documentation to the current cloud directory." echo "" echo "Options:" echo " --force Force overwrite of existing docs" echo " -h, --help Show this help message" echo "" exit 0 ;; -*) echo "Unknown option $1" echo "Usage: $0 [--force]" exit 1 ;; *) echo "Unexpected argument: $1" echo "Usage: $0" exit 1 ;; esac done # Initialize Wild Cloud environment if [ -z "${WC_ROOT}" ]; then echo "WC_ROOT is not set." exit 1 else source "${WC_ROOT}/scripts/common.sh" init_wild_env fi DOCS_DEST="${WC_HOME}/docs" # Check if docs already exist if [ -d "${DOCS_DEST}" ] && [ "${FORCE}" = false ]; then print_warning "Documentation already exists at ${DOCS_DEST}" read -p "Do you want to update documentation files? (y/N): " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then FORCE=true else print_info "Skipping documentation update." exit 0 fi fi # Copy docs directory from root to WC_HOME if [ -d "${WC_ROOT}/docs" ]; then if [ "${FORCE}" = true ] && [ -d "${DOCS_DEST}" ]; then rm -rf "${DOCS_DEST}" fi cp -r "${WC_ROOT}/docs" "${DOCS_DEST}" print_success "Documentation copied to ${DOCS_DEST}" else print_error "Source docs directory not found: ${WC_ROOT}/docs" exit 1 fi