#!/usr/bin/env bash ## eix-handy ## use eix to check which installed dependencies depend on a given useflag and or not ## ## examples ## - $ ./eix-handy -h ## - $ ./eix-handy -u qt5 ## - $ ./eix-handy -u python_targets_python2_7 -n python_targets_python3_[6789] ## ## alias for an eix command ## - $ eix -IUc python_targets_python2_7 --not --use python_targets_python3_[6789] # vars cmd="eix -IUc " useflag=" --use " notuseflag=" --not --use " usage="usage: $(basename $0) [-h] [[-u USEFLAG] [-n NOTUSEFLAG]]" # check for eix command # exit if not present if [ -z "$(command -v eix)" ]; then echo "missing eix" echo "please emerge app-portage/eix" exit 1 fi # check for arguments passed to script # exit if not present if [ -z $1 ]; then echo "missing arguments" echo $usage exit 1 fi # get script arguments while getopts "h:u:n:" opt; do case $opt in h) echo $usage exit 1 ;; u) if [[ -z $OPTARG ]] ; then echo "missing useflag argument" exit 1 fi useflag=$useflag$OPTARG cmd=$cmd$useflag echo "checking for packages with \"$useflag\"" ;; n) if [[ -z $OPTARG ]]; then echo "missing not useflag argument" exit 1 fi notuseflag=$notuseflag$OPTARG echo "excluding packages with \"$notuseflag\" useflag" cmd=$cmd$notuseflag ;; ?) echo $usage exit 1 ;; esac done # check arguments were passed to the script # and processed if [[ $OPTIND == 1 ]]; then echo "no arguments, please see -h" echo $usage exit 1 fi # execute eix command # set eix limit to show all matches regardless of output length EIX_LIMIT_COMPACT=0 $cmd exit 0