The-Repo-Club 127f414edb
Added Kiss package manager
Signed-off-by: The-Repo-Club <wayne6324@gmail.com>
2022-10-02 12:59:09 +01:00

31 lines
600 B
Bash
Executable File

#!/bin/sh -ef
# Copy a package's repository files into the current directory
pkg=${1:-"${PWD##*/}"}
num=$(printf %d "${2:-0}")
dir=$(kiss search "$pkg" 2>/dev/null) || {
printf 'usage: [kiss-fork [pkg]] [index]\n'
exit 1
}
# Globbing is disabled and word splitting is intentional.
# shellcheck disable=2086
set -- $dir
[ "$num" -ge "$#" ] && {
printf 'index exceeds maximum\n'
exit 1
}
shift "$num"
[ "$1" ] || [ -d "$1" ] || {
printf 'failed to locate package\n'
exit 1
}
printf 'found package in %s\n' "$1"
cp -Lrf "$1" .
printf 'forked package to %s\n' "$PWD/$pkg"