#!/usr/bin/env bash # summarize — Linux wrapper that delegates to Gemini CLI # Mimics: summarize [--length short|medium|long] [--youtube auto] # # The upstream steipete/summarize binary is macOS-only. # This wrapper uses the Gemini CLI (g) to summarize URLs, files, and YouTube links. set -euo pipefail if [[ $# -eq 0 ]]; then echo "Usage: summarize [--length short|medium|long|xl] [--youtube auto]" >&2 exit 1 fi TARGET="" LENGTH="medium" EXTRA_FLAGS=() while [[ $# -gt 0 ]]; do case "$1" in --length) LENGTH="$2"; shift 2 ;; --youtube|--model|--max-output-tokens|--firecrawl) shift 2 ;; # accepted but ignored — gemini handles format detection --extract-only|--json|--no-input) EXTRA_FLAGS+=("$1"); shift ;; -*) shift ;; # ignore unknown flags *) TARGET="$1"; shift ;; esac done if [[ -z "$TARGET" ]]; then echo "Error: no URL or file provided" >&2 exit 1 fi case "$LENGTH" in short) INSTRUCTION="in 2-3 sentences" ;; long) INSTRUCTION="in detail, covering all main points" ;; xl|xxl) INSTRUCTION="comprehensively, with structure and sections" ;; *) INSTRUCTION="in a clear medium-length summary" ;; esac # Detect if it's a file or URL if [[ -f "$TARGET" ]]; then PROMPT="Please summarize the following file $INSTRUCTION. File: $TARGET" gemini -p "$PROMPT" < "$TARGET" else gemini -p "Please summarize the content at this URL $INSTRUCTION: $TARGET" fi