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
14 changes: 14 additions & 0 deletions apps/files_external/lib/Command/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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,6 +41,11 @@ protected function configure(): void {
'value',
InputArgument::OPTIONAL,
'value to set the config option to, when no value is provided the existing value will be printed'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'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 path'

)->addOption(
'value-from-file',
null,
InputOption::VALUE_NONE,
'read the value from the file provided'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'read the value from the file provided'
'treat the value argument as a file path and read the config value from that file'

);
parent::configure();
}
Expand All @@ -57,6 +63,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