Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] new `usex` helper
Date: Tue, 13 Sep 2011 21:57:32
Message-Id: 201109131756.19714.vapier@gentoo.org
i keep writing little helpers like this in ebuilds:
usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; }

this is so i can do:
	export some_var=$(usex some_flag)
and get it set to "yes" or "no"

or if i want something a little different, i can do:
	export some_var=$(usex some_flag true false)
	export some_var=$(usex some_flag y n)

useful enough for EAPI ?  or should i just stick it into eutils.eclass ?  OR 
BOTH !?
-mike

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] new `usex` helper Donnie Berkholz <dberkholz@g.o>
Re: [gentoo-dev] new `usex` helper Mike Frysinger <vapier@g.o>
Re: [gentoo-dev] new `usex` helper Alec Warner <antarus@g.o>
Re: [gentoo-dev] new `usex` helper Mike Frysinger <vapier@g.o>