logo separator

[mkgmap-dev] evaluation of boolean options

From Steve Ratcliffe steve at parabola.me.uk on Wed Nov 26 22:26:58 GMT 2014

Hi Gerd

> the evaluation of boolean options in mkgmap is a bit confusing.
> It is possible to specify e.g.
> --drive-on-left

This is the only documented form for this option.

> --drive-on-left=true
> or
> --drive-on-left=false
> or
> --drive-on-left=any-value

These are all incorrect, I guess you could error out if
it is causing confusion.

The correct way to reverse a boolean is to prefix
with "no-" eg: --no-tdbfile.

But in this particular case it isn't even meaningful - what
should you do with --drive-on-right=false
or --no-drive-on-right; use the default? Which
is drive-on-right ;)

I suppose --drive-on=left|right would have been easier in
this case.

> In the current code both all have the same effect, because
> the evaluation is done like this:
> driveOnLeft = props.getProperty("drive-on-left") != null;
>
> On the other hand,
> --keep-going
> and
> --keep-going=false
> do not have the same effect, and that is true for most
> boolean options, because typically we use this kind of evaluation:
> linkPOIsToWays = props.getProperty("link-pois-to-ways", false);

Oh well, perhaps everyone disagrees with me then :) I guess all those
options were added before the "no-" prefix was available however.

..Steve


More information about the mkgmap-dev mailing list