29 lines
544 B
Bash
29 lines
544 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
#
|
||
|
# Autohor: darkmaster | https://github.com/grm34
|
||
|
#
|
||
|
|
||
|
get_pkg_list() {
|
||
|
# Usage: get_pkg_list "$@"
|
||
|
# Returns: pkg_list (array)
|
||
|
pkg_list=()
|
||
|
local entry pkg
|
||
|
for entry in "$@"; do
|
||
|
IFS=$'\n' read -d "" -ra pkg <<< "${entry//\//$'\n'}"
|
||
|
if [[ ${pkg[-1]} == "PKGBUILD" ]] && [[ ${#pkg[@]} -gt 3 ]]; then
|
||
|
pkg_list+=("${pkg[-2]}")
|
||
|
fi
|
||
|
done
|
||
|
}
|
||
|
|
||
|
# Run
|
||
|
git diff-tree --name-only --no-commit-id -r HEAD > temp
|
||
|
mapfile -t output < "temp"; rm -f temp
|
||
|
|
||
|
get_pkg_list "${output[@]}"
|
||
|
|
||
|
# Test
|
||
|
echo "${pkg_list[@]}"
|
||
|
|