summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 202a82f2a3fd4ae7be9ce3ce92b6d7fa1c53720a (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
33
34
35
36
37
38
39
40
41
42
43
44
45
# Maintainer: Your Name <alberto.diazdorado@tngtech.com>
# Maintainer: Nicholas Schwab <nicholas.schwab@tngtech.com>
pkgname=please-cli
pkgver=0.3.0
pkgrel=1
pkgdesc='An AI helper script to create CLI commands.'
arch=('any')
license=('Apache')
depends=('bash' 'jq' 'curl')
optdepends=('libsecret: store OpenApi key in keychain'
    'xclip: copy command to clipboard on X'
    'wl-clipboard: copy command to clipboard on Wayland')
makedepends=('sed' 'git')
install="${pkgname}.install"
source=('git+https://github.com/TNG/please-cli.git')
sha256sums=('SKIP')

pkgver() {
  cd "$pkgname"

  if [ -z "$VERSION" ]; then
    _tag=$(git tag --sort=v:refname | tail -n1)
    printf '%s.r%s.g%s' "${_tag#v}" "$(git rev-list "$_tag"..HEAD --count)" "$(git rev-parse --short HEAD)"
  else
    printf "$VERSION"
  fi
}

prepare() {
  cd "$pkgname"

  if [ -n "$VERSION" ]; then
    # Make specific version instead
    git checkout "release/v${VERSION}"
  fi

  # Patching the install command in an error message.
  sed -i -e 's/sudo apt install libsecret-tools/sudo pacman -S libsecret/' 'please.sh'
}

package() {
  cd "$pkgname"

  install -m 755 -DT 'please.sh' "${pkgdir}/usr/bin/please"
}