Initial commit
This commit is contained in:
26
bin/pdf-finder.php
Executable file
26
bin/pdf-finder.php
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use IO\ExceptionHandler;
|
||||
use IO\Input\FinderArguments;
|
||||
use IO\Output\DocumentListingOutput;
|
||||
use PDF\Document;
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
ExceptionHandler::registerCallback();
|
||||
|
||||
$arguments = FinderArguments::createFromGlobals();
|
||||
$directory = $arguments->getDirectory();
|
||||
$filters = $arguments->getFilters();
|
||||
|
||||
printf('Scanning "%s"...%s', $directory, PHP_EOL);
|
||||
$locator = new RecursiveDocumentLocator();
|
||||
$documents = $locator->findDocuments($directory);
|
||||
|
||||
foreach ($filters as $filter) {
|
||||
printf('Applying filter { %s }...%s', $filter, PHP_EOL);
|
||||
$documents = $documents->filter(fn(Document $document) => $filter->allows($document));
|
||||
}
|
||||
|
||||
DocumentListingOutput::forDocuments($documents)->render();
|
||||
19
bin/pdf-show-info.php
Executable file
19
bin/pdf-show-info.php
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use IO\ExceptionHandler;
|
||||
use IO\Input\ShowInfoArguments;
|
||||
use IO\Output\DocumentOutput;
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
ExceptionHandler::registerCallback();
|
||||
|
||||
$arguments = ShowInfoArguments::createFromGlobals();
|
||||
$file = $arguments->getFile();
|
||||
|
||||
$documentFactory = DocumentFactory::create();
|
||||
$document = $documentFactory->createDocument($file);
|
||||
|
||||
$output = DocumentOutput::forDocument($document);
|
||||
$output->render();
|
||||
Reference in New Issue
Block a user