(This is currently a draft and is subject to being changed.)

The syntax is: <tt>heromesh</tt> <i>&#91;switches]</i> <i>basename</i> <i>&#91;resources...]</i>

Switches are listed below. You can have more than one switch after a minus sign, if in the same argument.

The basename is the puzzle set name, including path if not in the current directory, but without the extension (there are four files, each with a different extension but the same basename).

Resources are relative to the puzzle set base (not the root node of the resource manager). See [.heromeshrc] for a list of the possible resources. These override resources in the .heromeshrc file.

<h2>Switches</h2>
  *  <tt>-c</tt> - Only load the .class file and check for errors. In this case, it will not complain if the .xclass and .level and .solution files do not exist.
  *  <tt>-C</tt> - Dump all compiled class codes to stdout. This is used mainly for testing.
  *  <tt>-e</tt> - Start the level editor, rather than play game.
  *  <tt>-H</tt> - Dump the hash table to stdout. This is used mainly for testing.
  *  <tt>-L</tt> - Meant for use with -c; lists all tokens it reads from the .class file (including macro expansions), rather than trying to parse it afterward. It does not check for any errors other than those in the lexer and macro preprocessor.
  *  <tt>-M</tt> - Meant for use with -c; display details of the macro system working.
  *  <tt>-T</tt> - Undocumented testing mode. This is meant for testing Free Hero Mesh itself.
  *  <tt>-t</tt> - Enable tracing.
  *  <tt>-v</tt> - Verbose logging mode.
  *  <tt>-x</tt> - Execute SQL statements from stdin. For example, you can use this to make a report of the levels or to convert levels from another file format.

<h2>Dot commands</h2>
When the <tt>-x</tt> switch is specified, it reads SQL statements from stdin. However, you can also use a line beginning with <tt>#</tt> as a comment, or a line beginning with <tt>.</tt> as a special command (neither works if an incomplete SQL statement has been read).

Valid dot commands are:
  *  <tt>.b0</tt> - Disable bail mode. SQL errors are ignored, but will prevent the current statement from executing, and any other statements on the same line.
  *  <tt>.b1</tt> - Enable bail mode (default). Any SQL errors are fatal.
  *  <tt>.f</tt> - Release memory and flush the SQLite cache.
  *  <tt>.i</tt> - Tell you the filename of the user cache database.
  *  <tt>.q</tt> - Quit.
  *  <tt>.u</tt> - Flush the user cache, causing the .level and .solution files to be rewritten if there are any pending changes. Should not be used while a transaction is active.
  *  <tt>.x0</tt> - Disable the LOAD_EXTENSION() function (default).
  *  <tt>.x1</tt> - Enable the LOAD_EXTENSION() function.

It also quits on EOF, but will complain if EOF occurs in the middle of a SQL statement.

Any result rows of SQL statements are written to stdout, with a vertical bar between columns and line breaks after each row.