// The three usage texts, kept apart from the commands so that editing the
// wording never touches control flow.

///|
fn write_usage() -> String {
  (
    #|write needs an input and an output: moonlake write --csv  --out  [options]
    #|
    #|  --csv           register a CSV file (repeatable)
    #|  --parquet       register a Parquet file (repeatable)
    #|  --date-col         declare an unannotated Parquet INT32 column as DATE
    #|  --out           where to write the Parquet file (required)
    #|  --table         which registered table to write (default: the only one)
    #|  --snappy              compress pages with Snappy instead of storing them raw
  )
}

///|
fn exec_usage() -> String {
  (
    #|usage: moonlake exec [(--csv  | --parquet  | --date-col )+] >
    #|
    #|CSV: first row is the header, types inferred. Parquet: DATE columns
    #|are declared with --date-col (epoch-day int32). File stems become
    #|table names; pass one --csv/--parquet per joined table. A --csv
    #|argument may carry one `*`: the matches scan into one table
    #|named by the pattern. The SQL is
    #|one quoted argument, or a file with --file (handy to skip shell
    #|quoting; a trailing semicolon is fine). With no --csv/--parquet
    #|the query runs against an empty catalog, so an expression check
    #|needs no dummy file.
    #|Examples:
    #|  moonlake exec --csv lineitem.csv \
    #|    "SELECT sum(x) AS s FROM lineitem WHERE x > 1"
    #|  moonlake exec --csv lineitem.csv --file q6.sql
    #|  moonlake exec "SELECT 1 + 1 AS two"
  )
}

///|
fn usage() -> String {
  (
    #|moonlake - embeddable analytical query engine for MoonBit
    #|
    #|Usage: moonlake [options] [command]
    #|
    #|Commands:
    #|  exec (--csv  | --parquet  | --date-col )+ 
    #|      Run a SELECT over CSV/Parquet files (one flag per table)
    #|  write (--csv  | --parquet  | --date-col )+ --out 
    #|      Write one registered table back out as Parquet
    #|      --table    pick the table (default: the only one)
    #|      --snappy         compress pages with Snappy
    #|
    #|    exec options:
    #|      --date-col         declare a Parquet column as DATE (epoch-day)
    #|      --explain             print the physical plan instead of running
    #|      --analyze             run it: plan plus actual rows per stage, and,
    #|                            where a monotonic clock exists, time per stage
    #|      --mem                 run it and print held bytes by structure, one
    #|                            block per census point (contract: ROADMAP)
    #|      --json                emit the result as one JSON array line
    #|      --memory [K|M|G]   budget for the blocking ORDER BY; beyond
    #|                            it runs spill to disk (external sort).
    #|                            At most 2147483647 bytes; 0 means no budget
    #|      --spill-dir      parent of this query's run files (default:
    #|                            TMPDIR); each query gets its own subdirectory
    #|
    #|Options:
    #|  --version   Print version and exit
    #|  --help      Print this help and exit
    #|
    #|The engine is under active development.
  )
}