On Tue, Feb 05, 2013 at 01:56:33AM +0100, Sébastien Luttringer wrote: > On Mon, Feb 4, 2013 at 11:58 PM, Dave Reisner <[email protected]> wrote: > > As a logical extension, allow the -p option to be specified multiple > > times in order to process several presets at once. > > --- > > This is more along the lines of what I had in mind. Only lightly tested. > > > > bash-completion | 2 +- > > man/mkinitcpio.8.txt | 8 ++++++-- > > mkinitcpio | 28 +++++++++++++++++++--------- > > 3 files changed, 26 insertions(+), 12 deletions(-) > > > ... > > # use preset $_optpreset (exits after processing) > > -[[ $_optpreset ]] && process_preset "$_optpreset" > > +if (( ${#_optpreset[*]} )); then > > + map process_preset "${_optpreset[@]}" > > + exit > > +fi > > > This is smaller but you don't have a clean bash context between preset > files call. In my original patch I use a subshell to avoid this and > this is why I doesn't use map function[1].
Fair point, but that's easily worked around by turning the entire process_preset function into a subshell, or simply scoping the ALL_* variables after sourcing the preset file. > By example, the first preset file define ALL_options and a second file > not. Without different context, second files execution will inherits > of this var and result from 2 call with -p options. > > Cheers, > > [1] To be honnest, I doesn't knew that function exists :p > > -- > Sébastien "Seblu" Luttringer > https://www.seblu.net > GPG: 0x2072D77A
