当前位置: 首页>>代码示例>>PHP>>正文


PHP Shell\Command类代码示例

本文整理汇总了PHP中Symfony\Component\Finder\Shell\Command的典型用法代码示例。如果您正苦于以下问题:PHP Command类的具体用法?PHP Command怎么用?PHP Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Command类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildContentFiltering

 protected function buildContentFiltering(Command $command, array $contains, $not = false)
 {
     foreach ($contains as $contain) {
         $expr = Expression::create($contain);
         $command->add('| xargs -I{} -r grep -I')->add($expr->isCaseSensitive() ? null : '-i')->add($not ? '-L' : '-l')->add('-Ee')->arg($expr->renderPattern())->add('{}');
     }
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:7,代码来源:GnuFindAdapter.php

示例2: buildContentFiltering

 /**
  * {@inheritdoc}
  */
 protected function buildContentFiltering(Command $command, array $contains, $not = false)
 {
     foreach ($contains as $contain) {
         $expr = Expression::create($contain);
         // todo: avoid forking process for each $pattern by using multiple -e options
         $command->add('| grep -v \'^$\'')->add('| xargs -I{} grep -I')->add($expr->isCaseSensitive() ? null : '-i')->add($not ? '-L' : '-l')->add('-Ee')->arg($expr->renderPattern())->add('{}');
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:11,代码来源:BsdFindAdapter.php

示例3: testCastToString

 public function testCastToString()
 {
     $cmd = Command::create();
     $cmd->add('--force');
     $cmd->add('--run');
     $this->assertSame('--force --run', (string) $cmd);
 }
开发者ID:Kyra2778,项目名称:AMR,代码行数:7,代码来源:CommandTest.php

示例4: buildDatesFiltering

 private function buildDatesFiltering(Command $command, array $dates)
 {
     foreach ($dates as $i => $date) {
         $command->add($i > 0 ? '-and' : null);
         $mins = (int) round((time() - $date->getTarget()) / 60);
         if (0 > $mins) {
             $command->add(' -mmin -0');
             return;
         }
         switch ($date->getOperator()) {
             case '<=':
                 $command->add('-mmin +' . ($mins - 1));
                 break;
             case '>=':
                 $command->add('-mmin -' . ($mins + 1));
                 break;
             case '>':
                 $command->add('-mmin -' . $mins);
                 break;
             case '!=':
                 $command->add('-mmin +' . $mins . ' -or -mmin -' . $mins);
                 break;
             case '<':
             default:
                 $command->add('-mmin +' . $mins);
         }
     }
 }
开发者ID:VicDeo,项目名称:poc,代码行数:28,代码来源:AbstractFindAdapter.php

示例5: __construct

 /**
  * @param AdapterInterface $adapter
  * @param Command          $command
  * @param \Exception|null  $previous
  */
 public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
 {
     $this->command = $command;
     parent::__construct($adapter, 'Shell command failed: "' . $command->join() . '".', $previous);
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:10,代码来源:ShellCommandFailureException.php

示例6: buildFormatSorting

 /**
  * {@inheritdoc}
  */
 protected function buildFormatSorting(Command $command, $format)
 {
     $command->get('find')->add('-printf')->arg($format . ' %h/%f\\n')->add('| sort | cut')->arg('-d ')->arg('-f2-');
 }
开发者ID:netvlies,项目名称:symfony,代码行数:7,代码来源:GnuFindAdapter.php

示例7: buildSorting

    private function buildSorting(Command $command, $sort)
    {
        switch ($sort) {
            case SortableIterator::SORT_BY_NAME:
                $format = null;
                break;
            case SortableIterator::SORT_BY_TYPE:
                $format = '%y';
                break;
            case SortableIterator::SORT_BY_ACCESSED_TIME:
                $format = '%A@';
                break;
            case SortableIterator::SORT_BY_CHANGED_TIME:
                $format = '%C@';
                break;
            case SortableIterator::SORT_BY_MODIFIED_TIME:
                $format = '%T@';
                break;
            default:
                throw new \InvalidArgumentException('Unknown sort options: '.$sort.'.');
        }

        $command->get('find')->add('-printf')->arg($format.' %h/%f\\n');
        $command->ins('sort')->add('| sort');
        $command->ins('awk')->add('| awk')->arg('{ print $'.(null === $format ? '1' : '2').' }');
    }
开发者ID:n3b,项目名称:symfony,代码行数:26,代码来源:GnuFindAdapter.php

示例8: buildSorting

 /**
  * @param Command $command
  * @param string  $sort
  *
  * @throws \InvalidArgumentException
  */
 private function buildSorting(Command $command, $sort)
 {
     switch ($sort) {
         case SortableIterator::SORT_BY_NAME:
             $command->ins('sort')->add('| sort');
             return;
         case SortableIterator::SORT_BY_TYPE:
             $format = '%y';
             break;
         case SortableIterator::SORT_BY_ACCESSED_TIME:
             $format = '%A@';
             break;
         case SortableIterator::SORT_BY_CHANGED_TIME:
             $format = '%C@';
             break;
         case SortableIterator::SORT_BY_MODIFIED_TIME:
             $format = '%T@';
             break;
         default:
             throw new \InvalidArgumentException('Unknown sort options: ' . $sort . '.');
     }
     $this->buildFormatSorting($command, $format);
 }
开发者ID:nicam,项目名称:symfony,代码行数:29,代码来源:AbstractFindAdapter.php


注:本文中的Symfony\Component\Finder\Shell\Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。