Files
gsfdc/demo-dify/dify/cli/scripts/lib/common.sh
T
wuzilongandCursor 6519682885 chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 13:59:25 +08:00

23 lines
656 B
Bash
Executable File

#!/usr/bin/env bash
# scripts/lib/common.sh — shared shell helpers for cli/ scripts.
[[ -n "${DIFYCTL_LIB_COMMON_SH:-}" ]] && return 0
readonly DIFYCTL_LIB_COMMON_SH=1
log::info() { printf '\033[36m[info]\033[0m %s\n' "$*" >&2; }
log::warn() { printf '\033[33m[warn]\033[0m %s\n' "$*" >&2; }
log::err() { printf '\033[31m[err ]\033[0m %s\n' "$*" >&2; }
die() { log::err "$*"; exit 1; }
# Resolve the cli/ directory (parent of scripts/).
cli::root() {
local dir
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
printf '%s' "$dir"
}
require() {
command -v "$1" >/dev/null 2>&1 || die "missing dependency: $1${2:+ — $2}"
}