Lists branches

@param bool $all    lists all remotes
@param bool $simple list only branch names

@throws \RuntimeException
@return string the command
770037
public function listBranches($all = false, $simple = false)
    {
        $this->clearAll();
        $this->addCommandName(self::BRANCH_COMMAND);
        if (!$simple) {
            $this->addCommandArgument('-v');
        }
        $this->addCommandArgument('--no-color');
        $this->addCommandArgument('--no-abbrev');
        if ($all) {
            $this->addCommandArgument('-a');
        }

        return $this->getCommand();
    }
118300
public function paginate($listRows = null, $simple = false, $config = [])
    {
        if (is_int($simple)) {
            $total  = $simple;
            $simple = false;
        }

        $paginate = Db::getConfig('paginate');

        if (is_array($listRows)) {
            $config   = array_merge($paginate, $listRows);
            $listRows = $config['list_rows'];
        } else {
            $config   = array_merge($paginate, $config);
            $listRows = $listRows ?: $config['list_rows'];
        }

        /** @var Paginator $class */
        $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']);
        $page  = isset($config['page']) ? (int) $config['page'] : call_user_func([
            $class,
            'getCurrentPage',
        ], $config['var_page']);

        $page = $page < 1 ? 1 : $page;

        $config['path'] = isset($config['path']) ? $config['path'] : call_user_func([$class, 'getCurrentPath']);

        if (!isset($total) && !$simple) {
            $options = $this->getOptions();

            unset($this->options['order'], $this->options['limit'], $this->options['page'], $this->options['field']);

            $bind    = $this->bind;
            $total   = $this->count();
            $results = $this->options($options)->bind($bind)->page($page, $listRows)->select();
        } elseif ($simple) {
            $results = $this->limit(($page - 1) * $listRows, $listRows + 1)->select();
            $total   = null;
        } else {
            $results = $this->page($page, $listRows)->select();
        }

        $this->removeOption('limit');
        $this->removeOption('page');

        return $class::make($results, $listRows, $page, $total, $simple, $config);
    }
571577
public function getNames()
    {
        $branches = $this->execute();
        $branches = \explode("\n", $branches);
        $branches = \array_map(
            function ($branch) {
                return \ltrim($branch, '*');
            },
            $branches
        );
        $branches = \array_map('trim', $branches);
        $branches = \array_filter($branches);

        return $branches;
    }
1090669
def list_branch(path = Dir.pwd)
      cg = MiniGit::Capturing.new(path)
      res = cg.branch :a => true
      res = res.split("\n")
      # Eventually reorder to make the first element of the array the current branch
      i = res.find_index { |e| e =~ /^\*\s/ }
      res[0], res[i] = res[i], res[0] unless (i.nil? || i.zero?)
      res.each { |e| e.sub!(/^\*?\s+/, '') }
      res
    end
1165866
public function branches()
    {
        if (null === $this->branches) {
            $retval = $this->execute('ls-remote', array('--heads' => true, $this->getUrl()));

            if ('' === trim($retval)) {
                return $this->branches = array();
            }

            $list = explode("\n", rtrim($retval));

            $branches = array();
            foreach ($list as $line) {
                list ($hash, $ref) = explode("\t", $line);
                $branches[] = new Reference(str_replace('refs/heads/', '', $ref), Reference::BRANCH, $hash);
            }

            $this->branches = $branches;
        }

        return $this->branches;
    }
1300109
private function parseSections(array $simple_parsed) {
        // do an initial pass to gather section names
        $sections = array();
        $globals = array();
        foreach ($simple_parsed as $k => $v) {
            if (is_array($v)) {
                // $k is a section name
                $sections[$k] = $v;
            } else {
                $globals[$k] = $v;
            }
        }

        // now for each section, see if it uses inheritance
        $output_sections = array();
        foreach ($sections as $k => $v) {
            $sects = array_map('trim', array_reverse(explode(':', $k)));
            $root = array_pop($sects);
            $arr = $v;
            foreach ($sects as $s) {
                if ($s === '^') {
                    $arr = array_merge($globals, $arr);
                } elseif (array_key_exists($s, $output_sections)) {
                    $arr = array_merge($output_sections[$s], $arr);
                } elseif (array_key_exists($s, $sections)) {
                    $arr = array_merge($sections[$s], $arr);
                } else {
                    throw new UnexpectedValueException("IniParser: In file '{$this->file}', section '{$root}': Cannot inherit from unknown section '{$s}'");
                }
            }

            if ($this->include_original_sections) {
                $output_sections[$k] = $v;
            }
            $output_sections[$root] = $arr;
        }


        return $globals + $output_sections;
    }
98440
public function branchExists($branch)
    {
        $result = $this->processHelper->runCommand(['git', 'branch', '--list', $branch], true);
        if (1 >= ($exists = preg_match_all('#(?<=\s)'.preg_quote($branch, '#').'(?!\w)$#m', $result))) {
            return 1 === $exists;
        }

        throw new \RuntimeException(sprintf('Invalid list of local branches found while searching for "%s"', $branch));
    }
565634
public function actionList($showAllVersions = false)
    {
        foreach ($this->apis as $id => $versions) {
            foreach ($versions as $version => $api) {
                if (!$showAllVersions) {
                    $this->stdout($api->name . ' - ' . $api->title . "\n");
                    break;
                } else {
                    $this->stdout($api->id . ' - ' . $api->title . "\n");
                }
            }
        }
    }
373477
public function listDirectory($directory, $recursive = false)
    {
        $results = $this->scanDirectory($directory, $recursive);

        if (false === $results) {
            throw new \RuntimeException(sprintf(
                'Unable to list directory "%s", maybe it is not a directory '.
                'or it does not exist.',
                $directory
            ));
        }

        return array(
            'files'       => $results[0],
            'directories' => $results[1]
        );
    }
1269903
public function nlist($directory)
    {
        $list = ftp_nlist($this->connection, $directory);
        if (!$list) {
            throw new \Exception("Could list files in remote directory: " . $directory);
        }

        return $list;
    }
865626
public static function ListAllFiles( string $folder, bool $recursive = false ) : array
   {

      // Init the array that should contain the resulting file paths
      $files = [];

      if ( ! @\is_dir( $folder ) )
      {
         // No folder = we are done here
         return $files;
      }

      if ( ! $recursive )
      {
         // List only files directly contained inside $folder (none from sub folders)

         // Open the directory pointer
         $d = \dir( $folder );
         // Ignore . and ..
         $d->read(); $d->read();
         // loop the rest
         while ( false !== ( $entry = $d->read() ) )
         {
            $tmp = Path::Combine( $folder, $entry );
            if ( ! \is_file( $tmp ) )
            {
               // Ignore sub folders
               continue;
            }
            $files[] = $tmp;
         }
         $d->close();
         return $files;
      }

      // List all files, also from sub folders
      static::_listRecursive( $files, $folder );

      return $files;

   }
1349150
public function getChildren($all = false)
    {
        $conn = DB::getConnect();
        $class = get_called_class();
        $meta = $class::getMetadata();

        if (!$all) {
            return self::find($meta['parentfield'] . '=' . $this->fields[$meta['keyfield']]);
        } else {
            return self::find($meta['keyfield'] . ' <> ' . $this->fields[$meta['keyfield']] . ' and ' . $meta['pathfield'] . " like " . $this->qstr('%' . sprintf('%08s', $this->fields[$meta['keyfield']]) . '%'));
        }
    }
485749
protected function collectBranch() : string
    {
        $branchesResult = $this->executor->execute('git branch');

        foreach ($branchesResult as $result) {
            if (strpos($result, '* ') === 0) {
                $exploded = explode('* ', $result, 2);

                return $exploded[1];
            }
        }

        throw new \RuntimeException();
    }
1305908
protected function listRunnables()
	{
		$commands = array_values(Command::getRegisteredCommands());
		$format = "| %8.60s | %-50.30s\n";
		
		printf($format, "id", "class");
		$this->env->sendOutput('-----------------------------------');
		foreach($commands as $runnable) {
			printf($format, $runnable->getId(), get_class($runnable));
			$this->env->sendOutput('-----------------------------------');
		}
	}
445662
public function getTreeSelectList(array $list, $root = 0)
    {
        $list = ArrayHelper::listToTree($list, $this->pkField, $this->parentField, '_child', $root);
        $list = $this->_toFormatTree($list, 0);
        
        return $this->buildTreeOptionsToArray($list);
    }
1015886
public function listStashes(array $options = null)
    {
        $this->clearAll();
        $this->addCommandName(self::STASH_COMMAND . ' list');
        if (null !== $options) {
            $this->addCommandSubject($options);
        }
        return $this->getCommand();
    }
316055
public function branches()
    {
        $result = $this->execute('list', array('--xml' => true, $this->getUrl() . '/' . $this->basePaths['branches']));

        $logTrunk = $this->log('/', null, 1);
        $logTrunk = reset($logTrunk);

        $branches = array();
        $branches[] = new Reference('trunk', Reference::BRANCH, $logTrunk->getRevision());

        foreach ($result as $fileinfo) {
            $branches[] = new Reference($fileinfo->getFilename(), Reference::BRANCH, $fileinfo->getCommit()->getRevision());
        }

        return $branches;
    }