#!/bin/sh

BINDIR=$(dirname $0)
MANDIR=$(realpath ${BINDIR})
DEB_VERSION=$(dpkg-parsechangelog -SVersion)
TMP=/tmp/repo_help2man

mkdir -p $TMP
cd $TMP
repo --time init -q --depth=1 -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1
for cmd in \
	abandon \
	branch \
	branches \
	checkout \
	cherry-pick \
	diff \
	diffmanifests \
	download \
	forall \
	gitc-delete \
	gitc-init \
	grep \
	help \
	info \
	init \
	list \
	manifest \
	overview \
	prune \
	rebase \
	selfupdate \
	smartsync \
	stage \
	start \
	status \
	sync \
	upload \
	version \
; do
	help2man -N -n "repo $cmd" -S "repo $cmd" -m "Repo Manual" -o ${MANDIR}/repo-${cmd}.1 repo -h "help $cmd"
done
help2man -N -n repo -S repo -m "Repo Manual" -o ${MANDIR}/repo.1 repo -h "help --all"
cd -
rm -rf $TMP
