本文整理匯總了PHP中Symfony\Component\Finder\Shell\Command::ins方法的典型用法代碼示例。如果您正苦於以下問題:PHP Command::ins方法的具體用法?PHP Command::ins怎麽用?PHP Command::ins使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Finder\Shell\Command
的用法示例。
在下文中一共展示了Command::ins方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildFormatSorting
/**
* {@inheritdoc}
*/
protected function buildFormatSorting(Command $command, $sort)
{
switch ($sort) {
case SortableIterator::SORT_BY_NAME:
$command->ins('sort')->add('| sort');
return;
case SortableIterator::SORT_BY_TYPE:
$format = '%HT';
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 = '%m';
break;
default:
throw new \InvalidArgumentException('Unknown sort options: '.$sort.'.');
}
$command
->add('-print0 | xargs -0 stat -f')
->arg($format.'%t%N')
->add('| sort | cut -f 2');
}
示例2: buildFormatSorting
/**
* {@inheritdoc}
*/
protected function buildFormatSorting(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.'.');
}
$command
->get('find')
->add('-printf')
->arg($format.' %h/%f\\n')
->add('| sort | cut')
->arg('-d ')
->arg('-f2-')
;
}
示例3: buildFindCommand
protected function buildFindCommand(Command $command, $dir)
{
return $command->ins('find')->add('find ')->arg($dir)->add('-noleaf');
}
示例4: buildFindCommand
/**
* @param Command $command
* @param string $dir
*
* @return Command
*/
protected function buildFindCommand(Command $command, $dir)
{
return $command->ins('find')->add('find ')->arg($dir)->add('-noleaf');
// the -noleaf option is required for filesystems that don't follow the '.' and '..' conventions
}
示例5: 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').' }');
}
示例6: 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);
}