Extracts common library from wild scripts.
This commit is contained in:
@@ -1,56 +1,13 @@
|
||||
#!/bin/bash
|
||||
#\!/bin/bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# Get WC_ROOT (where this script and templates live)
|
||||
WC_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)"
|
||||
export WC_ROOT
|
||||
# Source common utilities
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
|
||||
|
||||
# Set up cloud directory (WC_HOME is where user's cloud will be)
|
||||
WC_HOME="$(pwd)"
|
||||
export WC_HOME
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Helper functions
|
||||
print_header() {
|
||||
echo -e "\n${BLUE}=== $1 ===${NC}\n"
|
||||
}
|
||||
|
||||
print_info() {
|
||||
echo -e "${BLUE}INFO:${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}WARNING:${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}SUCCESS:${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}ERROR:${NC} $1"
|
||||
}
|
||||
|
||||
# Function to get current config value safely
|
||||
get_current_config() {
|
||||
local key="$1"
|
||||
if [ -f "${WC_HOME}/config.yaml" ]; then
|
||||
set +e
|
||||
result=$(wild-config "${key}" 2>/dev/null)
|
||||
set -e
|
||||
echo "${result}"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
# Initialize Wild-Cloud environment
|
||||
init_wild_env
|
||||
|
||||
# Usage function
|
||||
usage() {
|
||||
|
Reference in New Issue
Block a user