aboutsummaryrefslogtreecommitdiff
path: root/contrib/cpt-cat
blob: b8dc34ba589e98ade3d8de6c451cb95f48c023ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh -e
# Concatanate package files in the installed package database
# File names are printed to stderr.
case "$1" in
    --help|-h)
        printf 'usage: %s [pkg] [file...]\n' "${0##*/}"
        exit 0
        ;;
    '')
        [ "$#" -gt 1 ] && shift
        set -- "${PWD##*/}" "$@"
esac

pkg=$1; shift
cpt-list "$pkg" >/dev/null

[ "$1" ] || set -- build depends sources version

for file; do
    [ -f "$CPT_ROOT/var/db/cpt/installed/$pkg/$file" ] || continue
    printf '\033[1m%s:\033[m\n' "$file" >&2
    cat "$CPT_ROOT/var/db/cpt/installed/$pkg/$file"
done