-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpresent.php
More file actions
executable file
·44 lines (34 loc) · 840 Bytes
/
present.php
File metadata and controls
executable file
·44 lines (34 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env php
<?php
// ASCIIPoint runner script
define('FRAME_USLEEP', 65000);
if ($argc < 2){
echo "You must specify at least one slide.\n";
exit(1);
}
$cmdName = array_shift($argv);
$slides = [];
// Remaining arguments are slides
foreach ($argv as $candidate){
$candidate = new SplFileInfo($candidate);
if (!$candidate->isFile()) continue;
$candidate = include $candidate;
if ($candidate instanceOf Slide){
$slides[] = $candidate;
}
}
if (sizeOf($slides) == 0){
echo "No valid slides were found.\n";
echo "Be sure your slide files return the Slide object.\n";
exit(2);
}
$stdin = fopen('php://stdin', 'r');
stream_set_blocking($stdin, 0);
foreach ($slides as $slide){
$slide = array_shift($slides);
do {
$slide->tick();
usleep(FRAME_USLEEP);
$in = fgets($stdin);
} while (!$in);
}