[Omake] Confirmation dialog

Andrew Gacek andrew.gacek at gmail.com
Mon Feb 18 03:30:22 PST 2008


> .PHONY: test
>
> confirm(msg) =
>     println($(msg))
>     print($"Type YES to confirm or press Enter to abort: ")
>     RESULT = $(input-line $(stdin))
>     if $(not $(mem $(RESULT), YES yes))
>         exit 1
>
> test:
>     confirm($"This will eat your brain!")
>     println($"Consider your brain eaten!")
>
> .DEFAULT: test

This code works nicely, but I have two more questions/issues.

1) If I change confirm to be a no argument function, then it is
executed twice when building the test target.

2) I would prefer to prompt the user for confirmation before doing any
build work. For example, suppose the test target above depended on
building some large-file.zip. I tried to make a separate dependency
called confirm which handled this, but I was not able to ensure that
it would be the first dependency built.

Thanks,
Andrew


More information about the Omake mailing list