LuaLikeCommandRunner constructor

LuaLikeCommandRunner()

Implementation

LuaLikeCommandRunner()
  : super(
      'lualike',
      'LuaLike $lualikeVersion - A Lua-like scripting language for Dart\n'
          'Lua $luaCompatVersion compatible',
    ) {
  argParser
    ..addFlag(
      'debug',
      help: 'Enable debug mode with detailed logging',
      negatable: false,
    )
    ..addOption(
      'level',
      help: 'Set log level (FINE, INFO, WARNING, SEVERE, etc)',
    )
    ..addMultiOption(
      'category',
      help: 'Set log category filter (repeatable or comma-separated)',
      splitCommas: true,
    )
    ..addFlag('ast', help: 'Use AST interpreter (default)', defaultsTo: true)
    ..addFlag('ir', help: 'Use lualike IR runtime', defaultsTo: false)
    ..addFlag(
      'lua-bytecode',
      help: 'Use the opt-in lua_bytecode source engine',
      defaultsTo: false,
    )
    ..addFlag(
      'dump-ir',
      help: 'Print IR instructions and exit without executing (IR mode)',
      negatable: false,
      defaultsTo: false,
    )
    ..addFlag(
      'emit-llvm',
      help: 'Emit LLVM IR from the IR pipeline and exit without executing',
      negatable: false,
      defaultsTo: false,
    )
    ..addFlag(
      'emit-dart',
      help:
          'Emit Dart source from the IR pipeline and exit without executing',
      negatable: false,
      defaultsTo: false,
    )
    ..addFlag(
      'disassemble',
      help:
          'Print bytecode disassembly and exit without executing'
          ' (lua-bytecode mode)',
      negatable: false,
      defaultsTo: false,
    )
    ..addFlag(
      'raw',
      help: 'Skip bytecode peephole pass (raw lowering output)',
      negatable: false,
      defaultsTo: false,
    )
    ..addFlag(
      'fold',
      help: 'Enable constant folding pass for bytecode engines',
      negatable: true,
      defaultsTo: false,
    )
    ..addFlag(
      'compile',
      help:
          'Compile script to binary chunk; requires --output (do not execute)',
      negatable: false,
      defaultsTo: false,
    )
    ..addFlag(
      'native',
      help:
          'Compile to native binary via LLVM + Zig runtime. '
          'Requires --output, zig, llc, and clang on PATH.',
      negatable: false,
      defaultsTo: false,
    )
    ..addFlag(
      'check-env',
      help:
          'Check that zig, llc, and clang are available for --native compilation.',
      negatable: false,
      defaultsTo: false,
    )
    ..addOption(
      'output',
      abbr: 'o',
      help:
          'Output path for --compile or --native (required; any path — binary is '
          'detected by chunk header, not extension)',
      valueHelp: 'file',
    )
    ..addOption(
      'dart-output',
      help: 'Dart embed output file (precompiled_module.dart style)',
      valueHelp: 'file',
    )
    ..addFlag(
      'preserve-debug',
      help: 'Preserve debug line info in compiled bytecode',
      negatable: false,
      defaultsTo: false,
    )
    ..addMultiOption(
      'execute',
      abbr: 'e',
      help: 'Execute string',
      valueHelp: 'code',
      splitCommas: false,
    )
    ..addMultiOption(
      'require',
      abbr: 'l',
      help: 'Require file',
      valueHelp: 'file',
      splitCommas: false,
    )
    ..addFlag(
      'interactive',
      abbr: 'i',
      help: 'Enter interactive mode after running script',
      negatable: false,
    )
    ..addFlag('version', help: 'Print version information', negatable: false)
    ..addOption(
      'emit-docs',
      help: 'Emit built-in library documentation and exit.',
      allowed: const ['html', 'json', 'luals'],
      allowedHelp: const {
        'html': 'Shared documentation UI.',
        'json': 'Editor-friendly library metadata manifest.',
        'luals': 'LuaLS annotation stubs for existing Lua LSPs.',
      },
    )
    ..addOption(
      'lua-test',
      help:
          'Run a Lua test suite file with the standard test environment'
          ' (sets _port, _soft, package.path). Example: --lua-test calls',
      valueHelp: 'test',
    )
    ..addOption(
      'emit-docs-output',
      help: 'Output path for --emit-docs. Defaults to stdout.',
      valueHelp: 'path',
    )
    ..addFlag(
      'stdin',
      help: 'Execute stdin as a file (use - on command line)',
      negatable: false,
      hide: true,
    );
}