Created
January 11, 2020 11:41
-
-
Save novomirskoy/7b15045d769cb65e36c929ebd58893ab to your computer and use it in GitHub Desktop.
Скрипт который добавляет репозитории из директории vendor в PHPStorm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
echo <<<HEAD | |
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="VcsDirectoryMappings"> | |
HEAD; | |
$iter = new RecursiveIteratorIterator( | |
new RecursiveDirectoryIterator('.', RecursiveDirectoryIterator::SKIP_DOTS), | |
RecursiveIteratorIterator::SELF_FIRST, | |
RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied" | |
); | |
foreach ($iter as $path => $dir) { | |
if ($dir->isDir() && preg_match('_^\.(/(?:.*))?/\.(git|hg)$_', $path, $matches)) { | |
echo ' <mapping directory="$PROJECT_DIR$'.$matches[1].'" vcs="'.($matches[2] == 'hg' ? 'hg4idea' : 'Git').'" />' . PHP_EOL; | |
} | |
} | |
echo <<<END | |
</component> | |
</project> | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment