Skip to content

Commit 955afd0

Browse files
committed
feat: make path argument optional for uploads:import command
1 parent 3ee8cf8 commit 955afd0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Command/Uploads/ImportUploadsCommand.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function configure()
7070
$this
7171
->setName(self::NAME)
7272
->setDescription('Import files to the environment "uploads" directory')
73-
->addArgument('path', InputArgument::REQUIRED, 'The path to the files to import')
73+
->addArgument('path', InputArgument::OPTIONAL, 'The path to the files to import')
7474
->addOption('environment', null, InputOption::VALUE_REQUIRED, 'The environment to upload files to', 'staging')
7575
->addOption('force', null, InputOption::VALUE_NONE, 'Force the import to run')
7676
->addOption('size', null, InputOption::VALUE_REQUIRED, 'The number of files to process at a time');
@@ -81,7 +81,16 @@ protected function configure()
8181
*/
8282
protected function perform(InputInterface $input, OutputInterface $output)
8383
{
84-
$adapter = $this->getAdapter($this->getStringArgument($input, 'path'));
84+
$path = $this->getStringArgument($input, 'path');
85+
$projectType = $this->projectConfiguration->getProjectType();
86+
87+
if (empty($path) && 'bedrock' === $projectType) {
88+
$path = 'web/app/uploads';
89+
} elseif (empty($path) && 'wordpress' === $projectType) {
90+
$path = 'wp-content/uploads';
91+
}
92+
93+
$adapter = $this->getAdapter($path);
8594
$environment = (string) $this->getStringOption($input, 'environment');
8695
$filesystem = new Filesystem($adapter);
8796
$size = $this->getNumericOption($input, 'size');

0 commit comments

Comments
 (0)