mirror of
https://gh.wpcy.net/https://github.com/CaptainCore/captaincore.git
synced 2026-04-23 04:04:38 +08:00
36 lines
No EOL
760 B
Bash
Executable file
36 lines
No EOL
760 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
#
|
|
# Add a recipe to CaptainCore CLI.
|
|
#
|
|
# `captaincore recipe add <recipe>`
|
|
#
|
|
# --id=<id>
|
|
#
|
|
|
|
# Load configuration
|
|
root_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; root_path=${root_path%app*}
|
|
source ${root_path}lib/arguments
|
|
|
|
run_command() {
|
|
|
|
# Remove leading "--" from flags
|
|
for i in "${!flags[@]}"; do
|
|
flags[$i]=`echo ${flags[$i]} | cut -c 3-`
|
|
done
|
|
|
|
cd ${root_path}data
|
|
wp eval-file ../lib/local-scripts/recipe-add.php recipe=$1 ${flags[@]}
|
|
|
|
}
|
|
|
|
# See if any sites are specifed
|
|
if [ ${#arguments[*]} -eq 1 ]; then
|
|
# Runs on specifed sites
|
|
run_command ${arguments[*]}
|
|
fi
|
|
|
|
# Error if no sites specifed
|
|
if [ ${#arguments[*]} -eq 0 ]; then
|
|
echo -e "${COLOR_RED}Error:${COLOR_NORMAL} Please specify a recipe."
|
|
fi |