Summary: | usex: new `use` type helper | ||
---|---|---|---|
Product: | Gentoo Hosted Projects | Reporter: | SpanKY <vapier> |
Component: | PMS/EAPI | Assignee: | PMS/EAPI <pms> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | in-eapi-5 | ||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 174380 |
Description
SpanKY
2011-09-14 15:02:40 UTC
> the extended args allow for tricks like:
> usex foo --with{,out}-option =fast
Can you imagine a frequent usage case where the suffix isn't prefixed by an = sign? If not, the following would make the behaviour more consistent with what we have in use_with() and use_enable():
usex() { use "$1" && echo "${2-yes}${4+=$4}" || echo "${3-no}${5+=$5}" ; }
Your above example would become:
usex foo --with{,out}-option fast
(In reply to comment #1) > > the extended args allow for tricks like: > > usex foo --with{,out}-option =fast > > Can you imagine a frequent usage case where the suffix isn't prefixed by an = > sign? If not, the following would make the behaviour more consistent with what > we have in use_with() and use_enable(): > > usex() { use "$1" && echo "${2-yes}${4+=$4}" || echo "${3-no}${5+=$5}" ; } > > Your above example would become: > usex foo --with{,out}-option fast Why not just 'usex foo --with{,out}-option=fast' with = adding handled explicitly by caller? i'd rather not encode syntax decisions into the helper. i assume i cant foresee all the possibilities. and the overhead on the caller is minuscule. > usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; }
This returns always true. Is this what we want?
Maybe it would be more natural to return the status of the "use" call.
(In reply to comment #4) > > usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } > > This returns always true. Is this what we want? Hm, use_with and use_enable do the same. So I guess this is o.k. |