Sindbad~EG File Manager

Current Path : /home/escuelai/public_html/it/vendor/wapmorgan/unified-archive/bin/
Upload File :
Current File : /home/escuelai/public_html/it/vendor/wapmorgan/unified-archive/bin/cam

#!/usr/bin/env php
<?php
use wapmorgan\UnifiedArchive\CamApplication;
use wapmorgan\UnifiedArchive\UnifiedArchive;

$paths = [
	// as a root package or phar
	__DIR__.'/../vendor/autoload.php',
	// as a dependency from bin
	__DIR__.'/../autoload.php',
	// as a dependency from package folder
	__DIR__.'/../../../autoload.php',
	];
function init_composer(array $paths) {
	foreach ($paths as $path) {
		if (file_exists($path)) {
			require_once $path;
			return true;
		}
	}
	return false;
}
if (!init_composer($paths)) die('Run `composer install` firstly.'.PHP_EOL);
if (!class_exists('\Docopt')) die('Install docopt firsly. Run `composer require docopt/docopt ~1.0`.'.PHP_EOL);

$version = UnifiedArchive::VERSION;
$no_compression_level = \wapmorgan\UnifiedArchive\Drivers\BasicDriver::COMPRESSION_NONE;
$common_compression_level = \wapmorgan\UnifiedArchive\Drivers\BasicDriver::COMPRESSION_AVERAGE;
$maximum_compression_level = \wapmorgan\UnifiedArchive\Drivers\BasicDriver::COMPRESSION_MAXIMUM;

$doc = <<<DOC
Universal console archive manager for Windows/Linux (part of UnifiedArchive $version).

USAGE: cam (-l|--list)  ARCHIVE [FILTER]
       cam (-t|--table) ARCHIVE [FILTER]
       cam (-i|--info)  ARCHIVE
       cam (-e|--extract) [--password=PASSWORD] [--output=DIR] [--exclude=PATTERN] ARCHIVE [FILES_IN_ARCHIVE...]
       cam (-p|--print) [--password=PASSWORD] ARCHIVE FILES_IN_ARCHIVE...
       cam (-d|--details) ARCHIVE FILES_IN_ARCHIVE...
       cam (-x|--delete)  ARCHIVE FILES_IN_ARCHIVE...
       cam (-a|--add) [--path=(relative|absolute)] ARCHIVE FILES_ON_DISK...
       cam (-A|--add-from-stdin) ARCHIVE FILE_IN_ARCHIVE
       cam (-c|--create)
            [--compressionLevel=LEVEL] [--password=PASSWORD]
            [--comment=COMMENT] [--path=(relative|absolute)] ARCHIVE FILES_ON_DISK...
       cam (-C|--create-fake) [--path=(relative|absolute)] ARCHIVE FILES_ON_DISK...
       cam (-f|--formats)
       cam (-D|--drivers)

ACTIONS:
      -l(--list)    List files in archive
      -t(--table)   List files as table in archive
      -i(--info)    Summary about archive

      -e(--extract) Extract from archive

      -p(--print)   Extract archive file content on terminal
      -d(--details) Details about file in archive
      -x(--delete)  Delete files from archive

      -a(--add)     Pack files to archive
      -A(--add-from-stdin) Add file from STDIN
      -c(--create)  Create new archive

      -f(--formats) List all formats with support state
      -D(--drivers) List all drivers with installation information

OPTIONS:
    --password=PASSWORD      Password for decompression or compression (if supported by driver & format).
    --compressionLevel=LEVEL Compression level (if supported by driver & format). Values from $no_compression_level (no compression) to $maximum_compression_level (maximum compression) [default:$common_compression_level]
    --output=DIRECTORY       Set output directory in that all files will be extracted. [default:./]
    --comment=COMMENT        Set comment for an archive (if supported)

    --path=[relative|absolute]  Method of path processing [default: relative]
        Used for archive creation and appending.
            If "relative" used, then "cam -c archive.zip /home/user/abc /home/user/folder/" will create an archive with 
            "abc" and "folder" members in archive. If "absolute" is used, then members in archive will have absolute paths
            (/home/user/abc and /home/user/folder).

    --exclude FILES...
        or --exclude /PATTERN/. Excludes one or few files, directories by exact in-archive path or by regular expression pattern.
DOC;

$args = Docopt::handle($doc, ['version' => UnifiedArchive::VERSION]);

$actions = [
    'l:list' => 'listArray',
    't:table' => 'table',
    'i:info' => 'info',
    'e:extract' => 'extract',
    'p:print' => 'printFile',
    'd:details' => 'details',
    'x:delete' => 'delete',
    'a:add' => 'add',
    'A:add-from-stdin' => 'addFromStdin',
    'c:create' => 'create',
    'C:create-fake' => 'createFake',
    'f:formats' => 'checkFormats',
    'D:drivers' => 'checkDrivers',
];

foreach ($actions as $arg => $v) {
  $arg = explode(':', $arg);
    if ($args['-'.$arg[0]] === true || $args['--'.$arg[1]] === true) {
        $application = new CamApplication();
        call_user_func([$application, $v], $args);
    }
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists