Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion apps/files_external/lib/Command/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCP\AppFramework\Http;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Config extends Base {
Expand All @@ -40,7 +41,12 @@ protected function configure(): void {
)->addArgument(
'value',
InputArgument::OPTIONAL,
'value to set the config option to, when no value is provided the existing value will be printed'
'value to set the config option to; when omitted, the existing value is printed; with --value-from-file, this is treated as a file pat'
)->addOption(
'value-from-file',
null,
InputOption::VALUE_NONE,
'treat the value argument as a file path and read the config value from that file'
);
parent::configure();
}
Expand All @@ -58,6 +64,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$value = $input->getArgument('value');
if ($value !== null) {
if ($input->getOption('value-from-file')) {
Comment thread
artonge marked this conversation as resolved.
$file = $value;
$value = file_get_contents($file);
if ($value === false) {
$output->writeln('<error>Failed to load value from ' . $file . '</error>');
return 1;
}
}
$this->setOption($mount, $key, $value, $output);
} else {
$this->getOption($mount, $key, $output);
Expand Down
Loading