8000 bug #31510 Use the current working dir as default first arg in 'link'… · mathroc/symfony@a462760 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit a462760

Browse files
committed
bug symfony#31510 Use the current working dir as default first arg in 'link' binary (lyrixx)
This PR was merged into the 3.4 branch. Discussion ---------- Use the current working dir as default first arg in 'link' binary | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | I don't know how you work on symfony, but each time I face the same issue 1. I go on lyrixx/symfony (my fork) 1. I execute `pwd` and copy it 1. I go to an application 1. I paste the cwd + add `/link` and hit enter 1. I got an error because I missed the "target" 1. I replay the last command and add ` .` With this PR, I will save the last 2 items... Event if it's a "new feature", I targeted 3.4. Commits ------- 6b76c36 Use the current working dir as default first arg in 'link' binary
2 parents 721d721 + 6b76c36 commit a462760

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

link

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ use Symfony\Component\Filesystem\Filesystem;
2323
* @author Kévin Dunglas <dunglas@gmail.com>
2424
*/
2525

26-
if (2 !== $argc) {
27-
echo 'Link dependencies to components to a local clone of the main symfony/symfony GitHub repository.'.PHP_EOL.PHP_EOL;
28-
echo "Usage: $argv[0] /path/to/the/project".PHP_EOL;
29-
exit(1);
30-
}
26+
$pathToProject = $argv[1] ?? getcwd();
3127

32-
if (!is_dir("$argv[1]/vendor/symfony")) {
33-
echo "The directory \"$argv[1]\" does not exist or the dependencies are not installed, did you forget to run \"composer install\" in your project?".PHP_EOL;
28+
if (!is_dir("$pathToProject/vendor/symfony")) {
29+
echo 'Link dependencies to components to a local clone of the main symfony/symfony GitHub repository.'.PHP_EOL.PHP_EOL;
30+
echo "Usage: $argv[0] /path/to/the/project".PHP_EOL.PHP_EOL;
31+
echo "The directory \"$pathToProject\" does not exist or the dependencies are not installed, did you forget to run \"composer install\" in your project?".PHP_EOL;
3432
exit(1);
3533
}
3634

@@ -48,7 +46,7 @@ foreach ($directories as $dir) {
4846
}
4947
}
5048

51-
foreach (glob("$argv[1]/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
49+
foreach (glob("$pathToProject/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
5250
$package = 'symfony/'.basename($dir);
5351
if (is_link($dir)) {
5452
echo "\"$package\" is already a symlink, skipping.".PHP_EOL;
@@ -66,6 +64,6 @@ foreach (glob("$argv[1]/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as $dir)
6664
echo "\"$package\" has been linked to \"$sfPackages[$package]\".".PHP_EOL;
6765
}
6866

69-
foreach (glob("$argv[1]/var/cache/*") as $cacheDir) {
67+
foreach (glob("$pathToProject/var/cache/*") as $cacheDir) {
7068
$filesystem->remove($cacheDir);
7169
}

0 commit comments

Comments
 (0)
0