Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Ulrich Mueller <ulm@g.o>
Subject: Re: new `usex` helper
Date: Wed, 14 Sep 2011 08:02:29 +0200
>>>>> On Tue, 13 Sep 2011, Mike Frysinger wrote:

> On Tuesday, September 13, 2011 19:08:09 Brian Harring wrote:
>> Making it overridable seems wiser-
>> 
>> usex() {
>> 	local flag="$1"
>> 	local tval=${2-yes}
>> 	local fval=${3-no}
>> 	if use $flag; then
>> 		echo "${tval}"
>> 	else
>> 		echo "${fval}"
>> 	fi
>> }

Looks verbose. ;-)

> i dont get it.  mine already does exactly this, just in one line.
> usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; }

You should omit the colons though. ${2-yes} and ${3-no} will allow for
an explicit empty string as argument, whereas the :- variants won't.

Also quotes around the echo arguments can't harm.

Ulrich


Replies:
Re: new `usex` helper
-- Mike Frysinger
References:
new `usex` helper
-- Mike Frysinger
Re: new `usex` helper
-- Mike Frysinger
Re: new `usex` helper
-- Brian Harring
Re: new `usex` helper
-- Mike Frysinger
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: new `usex` helper
Next by thread:
Re: new `usex` helper
Previous by date:
Re: [RFC] obs eclasses
Next by date:
Re: [RFC] obs eclasses


Updated Jun 29, 2012

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.