mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
Support --help and -h flags in imagegen tool
Move API key check after argument parsing so help works without GEMINI_API_KEY set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
df903379fe
commit
25e74054c8
1 changed files with 6 additions and 6 deletions
|
|
@ -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 <prompt> [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}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue