-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflow
More file actions
executable file
·74 lines (63 loc) · 2.55 KB
/
Copy pathflow
File metadata and controls
executable file
·74 lines (63 loc) · 2.55 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env php
<?php declare(strict_types=1);
if (PHP_VERSION_ID < 80300) {
fwrite(STDERR, sprintf(
"Flow PHP requires PHP 8.3 or higher. You are running PHP %s.\n",
PHP_VERSION
));
exit(1);
}
use Flow\CLI\Command\DatabaseTableListCommand;
use Flow\CLI\Command\DatabaseTableSchemaCommand;
use Flow\CLI\Command\FileAnalyzeCommand;
use Flow\CLI\Command\FileConvertCommand;
use Flow\CLI\Command\FileReadCommand;
use Flow\CLI\Command\FileRowsCountCommand;
use Flow\CLI\Command\PipelineRunCommand;
use Flow\CLI\Command\FileSchemaCommand;
use Flow\CLI\Command\SchemaFormatCommand;
use Flow\CLI\FlowVersion;
use Flow\ParquetViewer\Command\ReadDataCommand;
use Flow\ParquetViewer\Command\ReadDDLCommand;
use Flow\ParquetViewer\Command\ReadMetadataCommand;
use Symfony\Component\Console\Application;
$pharRuntime = ('' !== Phar::running(false));
if ($pharRuntime) {
require 'phar://flow.phar/vendor/autoload.php';
} else {
if (\is_file(__DIR__ . '/vendor/autoload.php')) {
$autoloader = require __DIR__ . '/vendor/autoload.php';
} elseif (\is_file(__DIR__ . '/../vendor/autoload.php')) {
$autoloader = require __DIR__ . '/../vendor/autoload.php';
} elseif (\is_file(__DIR__ . '/../../vendor/autoload.php')) {
$autoloader = require __DIR__ . '/../../vendor/autoload.php';
} elseif (\is_file(__DIR__ . '/../../../vendor/autoload.php')) {
$autoloader = require __DIR__ . '/../../../vendor/autoload.php';
} else {
echo 'Cannot find the vendor directory, have you executed composer install?' . PHP_EOL;
echo 'See https://getcomposer.org to get Composer.' . PHP_EOL;
exit(1);
}
}
if (false === \in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
print PHP_EOL . 'This app may only be invoked from a command line, got "' . PHP_SAPI . '"' . PHP_EOL;
exit(1);
}
$_ENV['FLOW_PHAR_APP'] = 1;
\ini_set('memory_limit', -1);
$application = new Application('Flow PHP - Data processing framework', $pharRuntime ? FlowVersion::getVersion() : 'UNKNOWN');
$application->addCommands([
(new ReadDataCommand())->setName('parquet:read')->setAliases(['parquet:read:data']),
(new ReadMetadataCommand())->setName('parquet:read:metadata'),
(new ReadDDLCommand())->setName('parquet:read:ddl'),
new PipelineRunCommand(),
new FileReadCommand(),
new FileSchemaCommand(),
new FileRowsCountCommand(),
new FileConvertCommand(),
new FileAnalyzeCommand(),
new SchemaFormatCommand(),
new DatabaseTableListCommand(),
new DatabaseTableSchemaCommand(),
]);
$application->run();