kiss-repo

personal package repository
git clone git://bvnf.space/kiss-repo.git
Log | Files | Refs | README | LICENSE

commit 2adb1809acefd75b9233b9275581a0d0db7d04a0
parent ee1e7ed03beedc3426eaef5cb81e649ba0162128
Author: aabacchus <ben@bvnf.space>
Date:   Wed,  1 Sep 2021 02:58:01 +0100

kiss-find: git

Diffstat:
Akiss-find/build | 3+++
Akiss-find/checksums | 1+
Akiss-find/files/kiss-find.sh | 41+++++++++++++++++++++++++++++++++++++++++
Akiss-find/sources | 1+
Akiss-find/version | 1+
5 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/kiss-find/build b/kiss-find/build @@ -0,0 +1,3 @@ +#!/bin/sh -e + +install -Dm755 kiss-find.sh "$1/usr/bin/kiss-find" diff --git a/kiss-find/checksums b/kiss-find/checksums @@ -0,0 +1 @@ +6514a13c936b844b3b84abdebbe4408b5d524300c1c65359d9dccfa72967283a diff --git a/kiss-find/files/kiss-find.sh b/kiss-find/files/kiss-find.sh @@ -0,0 +1,41 @@ +#!/bin/sh -e +# Search for packages across every known repository + +VERSION="1" +DB_PATH="${XDG_CACHE_HOME:-${HOME}/.cache}"/kiss-find/db.gz +UPDATE_URL="https://github.com/jedahan/kiss-find/releases/download/latest/kiss-find.gz" + +mkdir -p "$(dirname "${DB_PATH}")" + +if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + echo "kiss-find ${VERSION}" + echo "$0 <query> :: Search for packages across every known repository" + echo "$0 -u :: Update package database" + exit +elif [ "$1" = "-u" ]; then + command -v curl >/dev/null || command -v wget >/dev/null || { + echo "please install curl or wget to update" >&2 && exit + } + + command -v curl >/dev/null && \ + command curl --location --silent \ + --user-agent "kiss-find/${VERSION}" \ + "${UPDATE_URL}" \ + --output "${DB_PATH}" + + command -v wget >/dev/null && \ + command wget -U "kiss-find/${VERSION}" "${UPDATE_URL}" -O "${DB_PATH}" + + echo ":: Update done" >&2 + exit +fi + +set -u # was required for the -z check above, can enable now + +if [ ! -f "${DB_PATH}" ]; then + echo ":: Please run with '-u' to update" >&2 + exit +fi + +zcat "${DB_PATH}" | jq --arg query "$@" \ + 'to_entries[] | select(.key | ascii_downcase | contains($query | ascii_downcase))' diff --git a/kiss-find/sources b/kiss-find/sources @@ -0,0 +1 @@ +https://github.com/jedahan/kiss-find/raw/main/package/kiss-find/files/kiss-find.sh diff --git a/kiss-find/version b/kiss-find/version @@ -0,0 +1 @@ +git 1