diff --git a/tools/imagegen b/tools/imagegen index 5232db519..aa7da7c89 100755 --- a/tools/imagegen +++ b/tools/imagegen @@ -10,11 +10,6 @@ if [[ -f "$REPO_ROOT/.env" ]]; then source "$REPO_ROOT/.env" fi -if [[ -z "${GEMINI_API_KEY:-}" ]]; then - echo "Error: GEMINI_API_KEY not set" >&2 - exit 1 -fi - usage() { echo "Usage: imagegen [output.png]" >&2 echo "" >&2 @@ -23,10 +18,15 @@ usage() { exit 1 } -if [[ $# -lt 1 ]]; then +if [[ $# -lt 1 ]] || [[ "${1:-}" == "--help" ]] || [[ "${1:-}" == "-h" ]]; then usage fi +if [[ -z "${GEMINI_API_KEY:-}" ]]; then + echo "Error: GEMINI_API_KEY not set" >&2 + exit 1 +fi + PROMPT="$1" OUTPUT="${2:-output.png}" MODEL="${IMAGEGEN_MODEL:-gemini-2.5-flash-image}"