1 |
On Tue, Sep 13, 2011 at 2:56 PM, Mike Frysinger <vapier@g.o> wrote: |
2 |
> i keep writing little helpers like this in ebuilds: |
3 |
> usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; } |
4 |
|
5 |
usex...you naughty boy. |
6 |
|
7 |
> |
8 |
> this is so i can do: |
9 |
> export some_var=$(usex some_flag) |
10 |
> and get it set to "yes" or "no" |
11 |
|
12 |
If the intent is to use it for logic: |
13 |
|
14 |
export some_var=$(usex some_flag) |
15 |
|
16 |
if [[ $some_var == yes ]]; then |
17 |
# buttsex |
18 |
fi |
19 |
|
20 |
Then I recommend making true / false the default and then doing |
21 |
|
22 |
if $some_var; then |
23 |
# buttsex |
24 |
fi |
25 |
|
26 |
If you are using it more like use_enable then...thats ok I guess ;p |
27 |
|
28 |
-A |
29 |
|
30 |
> |
31 |
> or if i want something a little different, i can do: |
32 |
> export some_var=$(usex some_flag true false) |
33 |
> export some_var=$(usex some_flag y n) |
34 |
> |
35 |
> useful enough for EAPI ? or should i just stick it into eutils.eclass ? OR |
36 |
> BOTH !? |
37 |
> -mike |
38 |
> |