Make websitebox command smarter: auto-add -d and -f flags
- 'websitebox up' now automatically runs 'docker compose up -d' - 'websitebox logs' now automatically runs 'docker compose logs -f' - All other commands pass through unchanged - Added 'source ~/.bashrc' instruction at end of installer so the command works immediately without logout/login - Updated tips and setup summary to show simplified commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
26
install.sh
26
install.sh
@@ -248,16 +248,24 @@ chmod +x setup.sh install.sh scripts/*.sh
|
|||||||
# Adds "websitebox" command that auto-cds into the project directory.
|
# Adds "websitebox" command that auto-cds into the project directory.
|
||||||
# Usage: websitebox up, websitebox logs, websitebox down, etc.
|
# Usage: websitebox up, websitebox logs, websitebox down, etc.
|
||||||
|
|
||||||
ALIAS_LINE="websitebox() { cd ${INSTALL_DIR} && docker compose \"\$@\"; }"
|
|
||||||
SHELL_RC="${HOME}/.bashrc"
|
SHELL_RC="${HOME}/.bashrc"
|
||||||
[ -f "${HOME}/.zshrc" ] && SHELL_RC="${HOME}/.zshrc"
|
[ -f "${HOME}/.zshrc" ] && SHELL_RC="${HOME}/.zshrc"
|
||||||
|
|
||||||
if ! grep -qF 'websitebox()' "$SHELL_RC" 2>/dev/null; then
|
if ! grep -qF 'websitebox()' "$SHELL_RC" 2>/dev/null; then
|
||||||
printf '\n# WebsiteBox shortcut\n%s\n' "$ALIAS_LINE" >> "$SHELL_RC"
|
cat >> "$SHELL_RC" <<'ALIASEOF'
|
||||||
ok "Added 'websitebox' command (e.g., websitebox up -d)"
|
|
||||||
|
# WebsiteBox shortcut
|
||||||
|
websitebox() {
|
||||||
|
cd ~/websitebox || return
|
||||||
|
case "$1" in
|
||||||
|
up) shift; docker compose up -d "$@" ;;
|
||||||
|
logs) shift; docker compose logs -f "$@" ;;
|
||||||
|
*) docker compose "$@" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
ALIASEOF
|
||||||
|
ok "Added 'websitebox' command"
|
||||||
fi
|
fi
|
||||||
# Make it available in the current session too
|
|
||||||
eval "$ALIAS_LINE"
|
|
||||||
|
|
||||||
# --- Run Setup Wizard ---
|
# --- Run Setup Wizard ---
|
||||||
|
|
||||||
@@ -272,11 +280,15 @@ fi
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
printf "${ORANGE} Tip:${RESET} You can manage your site from anywhere using the ${BOLD}websitebox${RESET} command:\n"
|
printf "${ORANGE} Tip:${RESET} You can manage your site from anywhere using the ${BOLD}websitebox${RESET} command:\n"
|
||||||
printf "${DIM} websitebox up -d ${RESET}${DIM}— start your site${RESET}\n"
|
printf "${DIM} websitebox up ${RESET}${DIM}— start your site${RESET}\n"
|
||||||
printf "${DIM} websitebox down ${RESET}${DIM}— stop your site${RESET}\n"
|
printf "${DIM} websitebox down ${RESET}${DIM}— stop your site${RESET}\n"
|
||||||
printf "${DIM} websitebox logs -f ${RESET}${DIM}— watch live logs${RESET}\n"
|
printf "${DIM} websitebox logs ${RESET}${DIM}— watch live logs${RESET}\n"
|
||||||
|
printf "${DIM} websitebox logs nginx ${RESET}${DIM}— logs for one service${RESET}\n"
|
||||||
printf "${DIM} websitebox restart nginx ${RESET}${DIM}— restart a service${RESET}\n"
|
printf "${DIM} websitebox restart nginx ${RESET}${DIM}— restart a service${RESET}\n"
|
||||||
echo ""
|
echo ""
|
||||||
|
info "Run this now to activate the websitebox command:"
|
||||||
|
printf " ${CYAN}source ${SHELL_RC}${RESET}\n"
|
||||||
|
echo ""
|
||||||
warn "If 'docker compose' commands fail later, log out and back in"
|
warn "If 'docker compose' commands fail later, log out and back in"
|
||||||
warn "to permanently activate Docker permissions, then try again."
|
warn "to permanently activate Docker permissions, then try again."
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
2
setup.sh
2
setup.sh
@@ -289,7 +289,7 @@ printf " ${GREEN}✓ Success looks like:${RESET} ${BOLD}${SERVER_IP}${RESET}
|
|||||||
printf " ${RED}✗ Not ready yet:${RESET} ${DIM}(blank output or a different IP — wait a few minutes and try again)${RESET}\n\n"
|
printf " ${RED}✗ Not ready yet:${RESET} ${DIM}(blank output or a different IP — wait a few minutes and try again)${RESET}\n\n"
|
||||||
printf " ${BLUE}3.${RESET} ${BOLD}Launch your website${RESET}\n"
|
printf " ${BLUE}3.${RESET} ${BOLD}Launch your website${RESET}\n"
|
||||||
printf " Once DNS is working, copy this command into the server terminal:\n\n"
|
printf " Once DNS is working, copy this command into the server terminal:\n\n"
|
||||||
printf " ${CYAN}websitebox up -d${RESET}\n\n"
|
printf " ${CYAN}websitebox up${RESET}\n\n"
|
||||||
printf " ${BLUE}4.${RESET} ${BOLD}Visit your site${RESET}\n"
|
printf " ${BLUE}4.${RESET} ${BOLD}Visit your site${RESET}\n"
|
||||||
printf " Your website: ${CYAN}https://${DOMAIN}${RESET}\n"
|
printf " Your website: ${CYAN}https://${DOMAIN}${RESET}\n"
|
||||||
printf " Admin login: ${CYAN}https://${DOMAIN}/wp-admin${RESET}\n"
|
printf " Admin login: ${CYAN}https://${DOMAIN}/wp-admin${RESET}\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user