1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-07-02 22:12:26 +00:00
kiss/contrib/kiss-fork

28 lines
625 B
Plaintext
Raw Normal View History

2020-03-13 13:43:54 +00:00
#!/bin/sh -ef
# Copy a package's repository files into the current directory.
2020-03-13 13:43:54 +00:00
# Ignore shellcheck as we want the warning's behavior.
# shellcheck disable=2015
[ "$1" ] && kiss s "${1:-null}" >/dev/null || {
printf 'usage: [kiss-fork [pkg]] [index]\n'
2020-03-13 13:43:54 +00:00
exit 1
}
num=$2
2020-03-13 13:43:54 +00: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
(
set -- $(kiss s "$1")
shift "${num:-0}"
[ -d "$1" ] && {
printf 'found package in %s\n' "$1"
cp -r "$1" .
}
2020-03-13 13:43:54 +00:00
)
printf 'forked package to %s\n' "$PWD/$1"