mirror of
https://github.com/verdigado/groupfolder_tags.git
synced 2024-11-21 12:47:27 +01:00
started implementation of occ command
This commit is contained in:
parent
bffbb74da4
commit
58796d4aaf
2 changed files with 53 additions and 0 deletions
|
@ -17,4 +17,7 @@
|
|||
<database>mysql</database>
|
||||
<nextcloud min-version="29" max-version="29"/>
|
||||
</dependencies>
|
||||
<commands>
|
||||
<command>OCA\GroupfolderTags\Command\Tag</command>
|
||||
</commands>
|
||||
</info>
|
50
lib/Command/Tag.php
Normal file
50
lib/Command/Tag.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GroupfolderTags\Command;
|
||||
|
||||
use OC\Core\Command\Base;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Tag extends Base {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure(): void {
|
||||
$this
|
||||
->setName('groupfolder-tags:update')
|
||||
->setDescription('Update or add a tag (and optional tag value) to a groupfolder by id')
|
||||
->addOption(
|
||||
'groupfolder_id',
|
||||
null,
|
||||
InputOption::VALUE_REQUIRED,
|
||||
'Add or update tag of the given groupfolder id'
|
||||
)
|
||||
->addOption(
|
||||
'tag_key',
|
||||
null,
|
||||
InputOption::VALUE_REQUIRED,
|
||||
'Set tag key to given value'
|
||||
)
|
||||
->addOption(
|
||||
'tag_value',
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'Set tag value to given value'
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
$groupFolderId = $input->getOption('groupfolder_id');
|
||||
$tagKey = $input->getOption('tag_key');
|
||||
$tagValue = $input->getOption('tag_value');
|
||||
|
||||
$output->writeln($groupFolderId . " " . $tagKey . " " . $tagValue);
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue