aboutsummaryrefslogtreecommitdiff
path: root/contrib/cpt-repodepends
blob: 525a62afffc6035e22d63b820590fc3649554087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh -e
# Display a package's dependencies in the repository

## SYNOPSIS:
## .Nm
## .Op Ar pkg

## DESCRIPTION:
## .Nm
## displays the dependencies of the given
## .Em repository package .
## If no package name is given,
## .Nm
## will use the name of the current directory as the package.
##
## Unlike
## .Xr cpt-depends 1 ,
## .Nm
## checks the package repository in order to print the dependencies, and the
## package does not have to be installed on the system.
## see: cpt-depends.1

case "$1" in
    --help|-h)
        printf '%s\n' "usage: ${0##*/} [pkg]"
        exit 0
        ;;
    '') set -- "${PWD##*/}"
esac

cpt-search "$1" >/dev/null
cat "$(cpt-search --single "$1")/depends" 2>/dev/null