From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1IonTg-0005AN-0e for garchives@archives.gentoo.org; Sun, 04 Nov 2007 21:57:56 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.1/8.14.0) with SMTP id lA4Lv5YO010423; Sun, 4 Nov 2007 21:57:05 GMT Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.191]) by robin.gentoo.org (8.14.1/8.14.0) with ESMTP id lA4LsXx8007014 for ; Sun, 4 Nov 2007 21:54:33 GMT Received: by nf-out-0910.google.com with SMTP id f5so1361735nfh for ; Sun, 04 Nov 2007 13:54:32 -0800 (PST) Received: by 10.78.137.7 with SMTP id k7mr3271879hud.1194213272164; Sun, 04 Nov 2007 13:54:32 -0800 (PST) Received: by 10.78.21.9 with HTTP; Sun, 4 Nov 2007 13:54:32 -0800 (PST) Message-ID: Date: Sun, 4 Nov 2007 14:54:32 -0700 From: "Alec Warner" Sender: antarus@scriptkitty.com To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] Re: More general interface to use flags Cc: gentoo-portage-dev@lists.gentoo.org In-Reply-To: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <472B29B9.50002@gentoo.org> X-Google-Sender-Auth: 9d21e30f65a312b1 X-Archives-Salt: 2d943b27-7a2c-402e-a465-925bf5d0a880 X-Archives-Hash: 31b10da2393e00e5bed8a00e5c2342db On 11/4/07, Steve Long wrote: > Marijn Schouten (hkBst) wrote: > > the current interface to use flags, useq, usev, use_with, use_enable, as > > defined in /usr/lib/portage/bin/ebuild.sh lacks generality. The common > > thing is testing a use flag and possibly echoing a string, but there is no > > function that implements this common behaviour. > > > > I propose that we add such a function. Proposed name for the function is > > "ifuse". > > > I like the overall API that is enabled (and that it doesn't break anything.) > > > I also propose to add the utility function "ifv" which is useful for > > writing concise and clean code. > > > This one seems a bit light-weight to me, but if it makes your life easier, > why not? > > One minor thing; -n is the default test, so: > [[ $1 ]] is the same as [[ -n $1 ]] > and: > [[ ! $1 ]] is the same as [[ -z $1 ]] > ''help test'' is very revealing, for those who haven't read it. ;-) Code Clarity over shortcuts. Use the explicit version. -- gentoo-dev@gentoo.org mailing list