Files
jsonedit/src/entry.php

31 lines
652 B
PHP
Raw Normal View History

2024-10-01 18:46:03 +02:00
<?php
2024-10-02 00:53:11 +02:00
use NoccyLabs\JEdit\Settings;
2024-10-01 18:46:03 +02:00
require_once __DIR__."/../vendor/autoload.php";
2024-10-02 00:53:11 +02:00
define("SETTINGS_FILE", getenv("HOME")."/.config/jsonedit/config.json");
$filename = $argv[1]??null;
2024-10-01 18:46:03 +02:00
$terminal = new NoccyLabs\JEdit\Terminal\Terminal();
2024-10-02 00:53:11 +02:00
Settings::load(SETTINGS_FILE);
2024-10-01 18:46:03 +02:00
$editor = new NoccyLabs\JEdit\Editor\Editor($terminal);
if ($filename) {
$editor->loadFile($filename);
} else {
$editor->loadDocument((object)[]);
}
set_exception_handler(function (\Throwable $t) use ($terminal) {
register_shutdown_function(function () use ($t, $terminal) {
$terminal->shutdown();
echo $t."\n";
});
});
$editor->run();