#!/usr/bin/env php
<?php

declare(strict_types=1);

try {
    require_once dirname(__DIR__) . '/autoload.php';
    exit((new M7\Identity\Cli\Application())->run($_SERVER['argv'] ?? []));
} catch (Throwable $exception) {
    $message = preg_replace(
        '/[\x00-\x1F\x7F]/',
        ' ',
        trim($exception->getMessage())
    ) ?? 'unexpected failure';
    fwrite(STDERR, 'm7-identity: ' . substr($message, 0, 512) . "\n");
    exit(1);
}
