On Fri, 20 Aug 2021, Sven Schreiber wrote:
Am 20.08.2021 um 19:14 schrieb Allin Cottrell:
> On Fri, 20 Aug 2021, Sven Schreiber wrote:
>> Right.
>> Then I was thinking of the "setopt" alternative, and this apparently
>> does not accept a string variable, as in:
>>
>> string a = "--quiet"
>> setopt ols a # error
>
> But
>
> string a = "--quiet"
> setopt ols @a
Yes, but in the end I'm aiming for b.a, string variable in a bundle (the
OP of the thread).
> if should_be_quiet
> setopt ols --quiet
> endif
>
> (making a condition, not a string, the relevant variable).
Again, yes, but I'm thinking of more possible options, where this block
is getting quite long:
if b.dspec == "--nc"
setopt vecm --nc
elif b.dspec == "--rc"
setopt vecm --rc
elif b.dspec == "--uc"
setopt vecm --uc
elif b.dspec == "--crt"
setopt vecm --crt
elif b.dspec == "-ct"
setop vecm --ct
endif
bundle b = _(dspec=3)
ostrs = defarray("--nc", "--rc", "--uc", "--crt",
"-ct")
ostr = ostrs[b.dspec]
setopt vecm @ostr
Allin