-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtmlshot
More file actions
43 lines (35 loc) · 1.38 KB
/
Copy pathhtmlshot
File metadata and controls
43 lines (35 loc) · 1.38 KB
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
#!/usr/bin/env php
<?php declare(strict_types=1);
use HtmlShot\Console\InstallCommand;
use HtmlShot\Console\UpdateCommand;
use Symfony\Component\Console\Application;
// Resolve the Composer autoloader whether this package is installed as a
// dependency (bin proxy sets $_composer_autoload_path) or run from its own
// checkout during development.
(static function (): void {
foreach ([
$_composer_autoload_path ?? null,
__DIR__.'/vendor/autoload.php',
__DIR__.'/../../autoload.php',
] as $file) {
if ($file !== null && is_file($file)) {
require $file;
return;
}
}
fwrite(STDERR, "Unable to locate the Composer autoloader. Run `composer install` first.\n");
exit(1);
})();
// The package root is the directory that holds this bin file. When installed as
// a dependency Composer runs the real bin from vendor/avvertix/html-shot, so
// __DIR__ always points at the package, not at the consuming project.
$packageRoot = __DIR__;
// The project root is where the user invoked the command — the consuming
// project — which is where natives.lock belongs (alongside composer.lock).
$projectRoot = getcwd() ?: $packageRoot;
$application = new Application('htmlshot');
$application->addCommands([
new InstallCommand($packageRoot, $projectRoot),
new UpdateCommand($packageRoot, $projectRoot),
]);
$application->run();