#!/usr/bin/env bash
set -euo pipefail
# POS: media yt — YouTube download tools (mp3/mp4/grab/ytsync/subtitles)
# POS_SUBCMDS: mp3 mp4 grab ytsync subtitles
source "$(dirname "$0")/../lib/common.sh" 2>/dev/null || source "$(dirname "$0")/common.sh"

usage() {
    cat <<'EOF'
Usage: pos media yt <command> [args]

YouTube download tools: audio, video, auto-grab, subtitles, channel sync.

Commands:
  mp3 <url>          Download audio as MP3
  mp4 <url>          Download video as MP4 (interactive format select)
  grab <url>         Auto-download as audio or video
  ytsync [cmd]       Incremental YouTube channel sync
  subtitles <url>    Extract subtitles/captions

Options:
  -h, --help         This help

Run 'pos media yt <command> --help' for details.
EOF
    exit 0
}

case "${1:-}" in
    -h|--help|"") usage ;;
esac
# Subcommands are resolved by the dispatcher via pos-media-yt-<sub> files.
# This file only handles bare 'pos media yt' (help) and unknown args.
err "unknown yt command: $1 (see 'pos media yt --help')"
