-
Notifications
You must be signed in to change notification settings - Fork 0
/
flow
executable file
·54 lines (44 loc) · 2.29 KB
/
flow
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
#!/usr/bin/env php
<?php declare(strict_types=1);
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\FlowVersion;
use Flow\ParquetViewer\Command\ReadDataCommand;
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->add((new ReadDataCommand())->setName('parquet:read')->setAliases(['parquet:read:data']));
$application->add((new ReadMetadataCommand())->setName('parquet:read:metadata'));
$application->add((new PipelineRunCommand())->setName('pipeline:run')->setAliases(['run']));
$application->add((new FileReadCommand())->setName('file:read')->setAliases(['read']));
$application->add((new FileSchemaCommand())->setName('file:schema')->setAliases(['schema']));
$application->add((new FileRowsCountCommand())->setName('file:rows:count')->setAliases(['count']));
$application->add((new FileConvertCommand())->setName('file:convert')->setAliases(['convert']));
$application->run();