Initial commit
This commit is contained in:
29
bin/faketerm
Executable file
29
bin/faketerm
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use NoccyLabs\FakeTerm\FakeTerminal;
|
||||
|
||||
require_once __DIR__."/../vendor/autoload.php";
|
||||
|
||||
$opts = getopt("hf:o:v:");
|
||||
|
||||
$r = sprintf("%02x%02x", rand(0,255), rand(0,255));
|
||||
$output = array_key_exists("o", $opts) ? $opts["o"] : "/tmp/ft_${r}_%04d.png";
|
||||
$input = array_key_exists("f", $opts) ? $opts["f"] : null;
|
||||
$video = array_key_exists("v", $opts) ? $opts["v"] : null;
|
||||
|
||||
if (!$input) {
|
||||
fwrite(STDERR, "Error: Need to specify at least -f, preferably -o\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$ft = new FakeTerminal();
|
||||
|
||||
if ($video) {
|
||||
printf("Rendering to video: %s\n", $video);
|
||||
$ft->setOutputVideo($video);
|
||||
}
|
||||
|
||||
$ft->setOutput($output);
|
||||
$ft->executeFile($input);
|
||||
|
Reference in New Issue
Block a user