diff --git a/appinfo/info.xml b/appinfo/info.xml index e0a7fe9..515e703 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -28,6 +28,7 @@ OCA\OrganizationFolders\Command\Resource\CreateResource OCA\OrganizationFolders\Command\Resource\ListResources OCA\OrganizationFolders\Command\Resource\UpdateResource + OCA\OrganizationFolders\Command\Resource\RemoveResource OCA\OrganizationFolders\Command\ResourceMember\CreateResourceMember OCA\OrganizationFolders\Command\ResourceMember\ListResourceMembers OCA\OrganizationFolders\Command\ResourceMember\RemoveResourceMember diff --git a/lib/Command/Resource/RemoveResource.php b/lib/Command/Resource/RemoveResource.php new file mode 100644 index 0000000..0d36598 --- /dev/null +++ b/lib/Command/Resource/RemoveResource.php @@ -0,0 +1,34 @@ +setName('organization-folders:remove-resource') + ->setDescription('Remove a resource') + ->addArgument('id', InputArgument::REQUIRED, 'Id of the resource'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int { + $id = (int)$input->getArgument('id'); + + try { + $this->resourceService->deleteById($id); + + $output->writeln("done"); + + return 0; + } catch (Exception $e) { + $output->writeln("Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}"); + return 1; + } + } +}