56 lines
No EOL
1.3 KiB
Bash
56 lines
No EOL
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
# commands/console.command.sh
|
|
#
|
|
# Framework-agnostic console command runner.
|
|
# Delegates to the active framework's console implementation.
|
|
#
|
|
# Aliased automatically to the framework's native name (yii, artisan etc.)
|
|
# via app::on_load — so both forms work:
|
|
#
|
|
# dx console migrate
|
|
# dx yii migrate (Yii2)
|
|
# dx artisan migrate (Laravel)
|
|
|
|
# ============================================
|
|
# Lifecycle
|
|
# ============================================
|
|
|
|
function cmd::console::on_load() {
|
|
flag::register --debug
|
|
}
|
|
|
|
# ============================================
|
|
# Public entrypoint
|
|
# ============================================
|
|
|
|
function cmd::console::run() {
|
|
if [[ $# -eq 0 ]]; then
|
|
cmd::console::help
|
|
return 0
|
|
fi
|
|
|
|
app::console "$@"
|
|
}
|
|
|
|
# ============================================
|
|
# Help
|
|
# ============================================
|
|
|
|
function cmd::console::help() {
|
|
local console_name
|
|
console_name="$(app::console_name)"
|
|
|
|
cat <<EOF
|
|
Usage: dx console <command> [args...]
|
|
dx ${console_name} <command> [args...]
|
|
|
|
Runs a console command inside the app container via the active framework.
|
|
Active framework: $(app::framework)
|
|
|
|
Examples:
|
|
dx console migrate
|
|
dx console db:seed
|
|
dx ${console_name} migrate
|
|
dx ${console_name} cache/flush
|
|
EOF
|
|
} |