44
55namespace Stolt \LeanPackage \Commands ;
66
7- use Stolt \LeanPackage \Exceptions \GitNotAvailable ;
8- use Stolt \LeanPackage \Exceptions \TreeNotAvailable ;
9- use Stolt \LeanPackage \Helpers \Str as OsHelper ;
107use Stolt \LeanPackage \Tree ;
118use Symfony \Component \Console \Command \Command ;
129use Symfony \Component \Console \Input \InputArgument ;
@@ -57,21 +54,18 @@ protected function configure(): void
5754
5855 protected function execute (InputInterface $ input , OutputInterface $ output ): int
5956 {
60- $ directory = (string ) $ input ->getArgument ('directory ' );
57+ $ this -> directoryToOperateOn = (string ) $ input ->getArgument ('directory ' );
6158
62- if ($ directory !== $ this ->directoryToOperateOn ) {
63- if (!\file_get_contents ($ directory ) || !\is_dir ($ directory )) {
64- $ warning = "Warning: The provided directory "
65- . "' $ directory' does not exist or is not a directory. " ;
66- $ outputContent = '<error> ' . $ warning . '</error> ' ;
67- $ output ->writeln ($ outputContent );
59+ if (!\is_dir ($ this ->directoryToOperateOn )) {
60+ $ warning = "Warning: The provided directory "
61+ . "' $ this ->directoryToOperateOn ' does not exist or is not a directory. " ;
62+ $ outputContent = '<error> ' . $ warning . '</error> ' ;
63+ $ output ->writeln ($ outputContent );
6864
69- return Command::FAILURE ;
70- }
65+ return Command::FAILURE ;
7166 }
7267
7368 $ showSrcTree = $ input ->getOption ('src ' );
74- $ showDistPackageTree = $ input ->getOption ('dist-package ' );
7569
7670 if ($ showSrcTree ) {
7771 $ verboseOutput = '+ Showing flat structure of package source. ' ;
@@ -94,7 +88,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9488
9589 protected function getPackageName (): string
9690 {
97- $ composerContentAsJson = \json_decode (\file_get_contents ('composer.json ' ), true );
91+ $ composerContentAsJson = \json_decode (
92+ \file_get_contents ($ this ->directoryToOperateOn . DIRECTORY_SEPARATOR . 'composer.json ' ),
93+ true
94+ );
9895 return \trim ($ composerContentAsJson ['name ' ]);
9996 }
10097}
0 commit comments