#!/usr/bin/env -S deno run --allow-all

/**
 * Onebox - Self-hosted container platform
 *
 * Entry point for the Onebox CLI and daemon.
 */

import { runCli } from './ts/index.ts';
import { getErrorMessage } from './ts/utils/error.ts';

if (import.meta.main) {
  try {
    await runCli();
  } catch (error) {
    console.error(`Error: ${getErrorMessage(error)}`);
    if (Deno.args.includes('--debug') && error instanceof Error) {
      console.error(error.stack);
    }
    Deno.exit(1);
  }
}
