Conditional Commands#

As of 0.9.10 Enkaidu supports conditional continuation commands that start with a ?.

Macros are sequences of queries that were executed in order, and nested calls to macros were inserted at the call site and then executed in sequence. Until now we did not have a way for a macro to ask a model to do some work and then test for that.

Using the new ?break with if... or unless... conditional commands macros can now make branching decisions, allowing them to exit a macro earlier in its query sequence.

  • Break on condition#

    • ?break if file_exists=<PATH>
      • Exit macro if given file exists
    • ?break if file=<PATH> contains=<STR>
      • Exit macro if given file exists and contains given string
    • ?break if global ns=<NAMESPACE> key=<STR> equals=<STR>
      • Exit macro if global state key has matching value
    • ?break unless file_exists=<PATH>
      • Exit macro unless given file exists
    • ?break unless file=<PATH> contains=<STR>
      • Exit macro unless given file exists and contains given string
    • ?break unless global ns=<NAMESPACE> key=<STR> equals=<STR>
      • Exit macro unless global state key has matching value