diff --git a/bin/phpstan b/bin/phpstan new file mode 100755 index 0000000000000000000000000000000000000000..26807077f740a6880b08a3839084780e56544243 --- /dev/null +++ b/bin/phpstan @@ -0,0 +1,4 @@ +#!/bin/bash + +export $(cat .env | xargs) +docker run --rm -v $(php /usr/local/bin/volume.php /app) phpstan/phpstan "$@" diff --git a/bin/volume.php b/bin/volume.php index e2db5ee329d0a69490d21147b6196f483dbaed93..aa9e78c2bb28a26ae5522b3b943bdb20aa587c33 100644 --- a/bin/volume.php +++ b/bin/volume.php @@ -16,15 +16,17 @@ function readContainerConfig() { return []; } -function getDockerMountSource() { +function getDockerMountSource($args) { $currentDir = getcwd(); + $destDir = (empty($args[1])) ? $currentDir : $args[1]; + $container = readContainerConfig(); foreach ($container['Mounts'] as $mount) { if (strpos($currentDir, $mount['Destination']) === 0) { - return $mount['Source'] . ':' . $mount['Destination']; + return $mount['Source'] . ':' . (empty($args[1]) ? $mount['Destination'] : $destDir); } } - return $currentDir . ':' . $currentDir; + return $currentDir . ':' . $destDir; } -print(getDockerMountSource()); +print(getDockerMountSource($argv));