2020-03-13 07:43:54 -06:00
|
|
|
#!/bin/sh -ef
|
2020-05-01 00:07:20 -06:00
|
|
|
# Copy a package's repository files into the current directory
|
2020-03-13 07:43:54 -06:00
|
|
|
|
2020-04-18 03:11:56 -06:00
|
|
|
# Ignore shellcheck as we want the warning's behavior.
|
|
|
|
# shellcheck disable=2015
|
2020-09-04 11:32:19 -06:00
|
|
|
[ "$1" ] && kiss search "${1:-null}" >/dev/null || {
|
2020-04-25 08:48:44 -06:00
|
|
|
printf 'usage: [kiss-fork [pkg]] [index]\n'
|
2020-03-13 07:43:54 -06:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2020-04-25 08:48:44 -06:00
|
|
|
num=$2
|
|
|
|
|
2020-03-13 07:43:54 -06:00
|
|
|
# Disable this warning as globbing is disabled and word splitting
|
|
|
|
# is intentional. This grabs the location of the package's files.
|
|
|
|
# shellcheck disable=2046
|
|
|
|
(
|
2020-09-04 11:32:19 -06:00
|
|
|
set -- $(kiss search "$1")
|
2020-03-13 07:43:54 -06:00
|
|
|
|
2020-04-25 08:48:44 -06:00
|
|
|
shift "${num:-0}"
|
|
|
|
|
|
|
|
[ -d "$1" ] && {
|
|
|
|
printf 'found package in %s\n' "$1"
|
|
|
|
cp -r "$1" .
|
|
|
|
}
|
2020-03-13 07:43:54 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
printf 'forked package to %s\n' "$PWD/$1"
|