Gentoo Archives: gentoo-portage-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Marijn Schouten (hkBst)" <hkBst@g.o>
Subject: Re: [gentoo-portage-dev] use* cleanup
Date: Wed, 31 Oct 2007 16:56:42
Message-Id: 200710311255.50182.vapier@gentoo.org
In Reply to: Re: [gentoo-portage-dev] use* cleanup by "Marijn Schouten (hkBst)"
1 On Wednesday 31 October 2007, Marijn Schouten (hkBst) wrote:
2 > I hope this is just an artifact of the patch being a bit opaque. The
3 > inconsistent indentation in the patch is a consequence of emacs bash mode
4 > using a different indentation style than (I guess) vi(m). I'm sure even in
5 > vi you can re-indent my code with one simple key-chord.
6
7 no idea, i dont use vi ... but you're writing the patch which means you get to
8 fix it ;)
9
10 > The immediate motivation of my examining this code was a request on
11 > #gentoo-dev-help by lack for something which I could with my new code
12 > easily write like this:
13 >
14 > use_mime() {
15 > local WORD="$(_if $2 $2 $1)"
16 >
17 > _use $1 "${WORD};"
18 > }
19
20 write where ? in eclasses/ebuilds ?
21
22 > local SUFFIX="$(_if $3 "=$3")"
23 > local WORD="$(_if $2 $2 $1)"
24
25 local FOO=$(...)
26 extraneous quoting makes eyes bleed
27
28 > _if() {
29 > if $1; then echo $2; else echo $3; fi
30 > }
31
32 $1 && echo $2 || echo $3
33
34 > if hasq ${flag} ${USE} ; then
35 > echo ${string_success}; return ${found}
36 > else
37 > echo ${string_failure}; return $((!found))
38 > fi
39
40 no point in cuddling those lines
41
42 > What's not to like?
43
44 when you've written it out, it does look much nicer ... but i'd like to
45 understand the motivation behind it first ...
46 -mike

Attachments

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

Replies

Subject Author
Re: [gentoo-portage-dev] use* cleanup "Marijn Schouten (hkBst)" <hkBst@g.o>