# Maintainer: American_Jesus <american.jesus.pt AT gmail DOT com>

pkgname=nano-syntax-highlighting
conflicts=(${pkgname}-git)
replaces=(${pkgname}-git)
pkgver=2020.10.10
pkgrel=2
pkgdesc="Nano editor syntax highlighting enhancements"
arch=('any')
depends=('nano')
url="https://github.com/scopatz/nanorc"
license=('custom')
install=nano-syntax-highlighting.install
source=(https://github.com/scopatz/nanorc/releases/download/2020.10.10/nanorc-${pkgver}.tar.gz
        'nanorc.sample')
sha256sums=('cd674e9eb230e4ba306b418c22d1891d93a3d2ffdf22234748d3398da50dfe64'
            '173e76e537261fc3633954e4ad4f807576f7cf2fc82edfdae205a721021bc805')
noextract=(nanorc-${pkgver}.tar.gz)

prepare() {
  [[ -d ${srcdir}/nanorc-${pkgver} ]] && rm -rf ${srcdir}/nanorc-${pkgver}
  tar -xzf ${srcdir}/nanorc-${pkgver}.tar.gz -C $srcdir || true
}

package() {
  cd ${srcdir}

  mkdir -p ${pkgdir}/usr/share/${pkgname}

  find ${srcdir}/nanorc-${pkgver}/ -name '*.nanorc' | xargs install -D -m644 -t ${pkgdir}/usr/share/${pkgname}/

  install -D -m644 ${srcdir}/nanorc.sample ${pkgdir}/usr/share/${pkgname}/nanorc.sample
}
