Add a function to query IUSE_EFFECTIVE for flags.
---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index c650a4c..e0ade02 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -80,6 +80,10 @@ ___eapi_has_eapply_user() {
        [[ ! ${1-${EAPI}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_has_in_iuse() {
+       [[ ! ${1-${EAPI}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_has_master_repositories() {
        [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index a6e1cdb..e2376bf 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1036,6 +1036,22 @@ if ___eapi_has_eapply_user; then
        }
 fi
 
+if ___eapi_has_in_iuse; then
+       in_iuse() {
+               local use=${1}
+
+               if [[ -z "${use}" ]]; then
+                       echo "!!! in_iuse() called without a parameter." >&2
+                       echo "!!! in_iuse <USEFLAG>" >&2
+                       die "in_iuse() called without a parameter"
+               fi
+
+               local liuse=( ${IUSE_EFFECTIVE} )
+
+               has "${use}" "${liuse[@]#[+-]}"
+       }
+fi
+
 if ___eapi_has_master_repositories; then
        master_repositories() {
                local output repository=$1 retval
-- 
2.1.3


Reply via email to