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
So you would rather use the current workaround with a copy:
dspec = b.dspec
setopt vecm @dspec
All this then boils down to whether the one-line temporary copy into a
non-bundled variable can be avoided. Not terribly important, admittedly,
it's just that such temporary copies feel a little stupid when you write
them.
thanks
sven