-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector-archive-command.php
More file actions
35 lines (28 loc) · 1021 Bytes
/
vector-archive-command.php
File metadata and controls
35 lines (28 loc) · 1021 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
<?php
declare(strict_types=1);
use Vector\Archive\ExportCommand;
use Vector\Archive\InfoCommand;
use Vector\Archive\ManifestCommand;
use Vector\Archive\ValidateCommand;
if (! class_exists('WP_CLI')) {
return;
}
if (file_exists(__DIR__.'/vendor/autoload.php')) {
require_once __DIR__.'/vendor/autoload.php';
} else {
spl_autoload_register(static function (string $class): void {
$prefix = 'Vector\\Archive\\';
if (! str_starts_with($class, $prefix)) {
return;
}
$relativeClass = mb_substr($class, mb_strlen($prefix));
$file = __DIR__.'/src/'.str_replace('\\', '/', $relativeClass).'.php';
if (file_exists($file)) {
require_once $file;
}
});
}
WP_CLI::add_command('vector-archive export', ExportCommand::class);
WP_CLI::add_command('vector-archive manifest', ManifestCommand::class);
WP_CLI::add_command('vector-archive validate', ValidateCommand::class);
WP_CLI::add_command('vector-archive info', InfoCommand::class);