function listmatch() {
local arg=${1}
shift
-
- local value
- for value in $@; do
- if [ "${arg}" == "${value}" ]; then
- return 0
- fi
- done
- return 1
+
+ grep -q "<${arg}>" <<<$@
}
function listremove() {
}
function find_package() {
- local package
+ local package=${1}
local i
- local found
- for package in $@; do
- #log DEBUG "Searching for package \"${package}\"."
-
- if [ -e "${DIR_PKGS}/${package}" ]; then
- echo "${package}"
- continue
- fi
-
- found=0
- for i in $(package_list); do
- if [ "${i##*/}" = "${package}" ]; then
- echo "${i}"
- found=1
- break
- fi
- done
- [ "${found}" = "1" ] && continue
+ #log DEBUG "Searching for package \"${package}\"."
- return 1
+ if [ -e "${DIR_PKGS}/${package}" ]; then
+ echo "${package}"
+ return 0
+ fi
+
+ for i in $(package_list); do
+ if [ "${i##*/}" = "${package}" ]; then
+ echo "${i}"
+ return 0
+ fi
done
- return 0
+ return 1
}
function find_packages() {
## Needs to be cached...
# Causes massive speed impact
-function package_list() {
+function __package_list() {
local package
local repo
done
}
+function package_list() {
+ if [ -z "${__PACKAGE_LIST}" ]; then
+ log CACHE "Building packages_list."
+ export __PACKAGE_LIST=$(__package_list)
+ fi
+
+ echo "${__PACKAGE_LIST}"
+}
+
function package_profile() {
if [ "${1}" = "--wiki" ]; then
echo "TODO: WIKI OUTPUT"