#!/bin/sh

# Copyright (c) 2007-2008 Aleksey Cheusov <cheusov@NetBSD.org>
# All rights reserved.
#
# See LICENSE file
######################################################################

set -e

. pkg_online_server.env
. pipestatus

export LC_ALL=C

suff="-$PKG_SUMMARY_TYPE"
msg=" $PKG_SUMMARY_TYPE"

grep_interesting_fields () {
    grep -E '^(PKGNAME=|PKGPATH=|SIZE_PKG=|CATEGORIES=|COMMENT=|HOMEPAGE=|MAINTAINER=|DESCRIPTION=|$)' \
	"$@"
}

runpipe0 \
    grep_interesting_fields "$@" '|' \
    pkg_summary2dict '|' \
    dictfmt -c5 -q -s "pkgsrc packages: shortinfo database" \
        --allchars --index-data-separator '|%%|' \
        --without-header --without-headword -u 'http://www.pkgsrc.org' \
        pkgsrc${suff}-shortinfo --columns 0
