summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/appinfo/info.xml2
-rw-r--r--apps/files/composer/composer/autoload_classmap.php2
-rw-r--r--apps/files/composer/composer/autoload_static.php2
-rw-r--r--apps/files/lib/Command/Delete.php (renamed from core/Command/Info/Delete.php)5
-rw-r--r--apps/files/lib/Command/Get.php (renamed from core/Command/Info/Get.php)17
-rw-r--r--core/register_command.php2
6 files changed, 17 insertions, 13 deletions
diff --git a/apps/files/appinfo/info.xml b/apps/files/appinfo/info.xml
index 985a26f6611..77e90a9cbb4 100644
--- a/apps/files/appinfo/info.xml
+++ b/apps/files/appinfo/info.xml
@@ -35,6 +35,8 @@
<command>OCA\Files\Command\TransferOwnership</command>
<command>OCA\Files\Command\ScanAppData</command>
<command>OCA\Files\Command\RepairTree</command>
+ <command>OCA\Files\Command\Get</command>
+ <command>OCA\Files\Command\Delete</command>
</commands>
<activity>
diff --git a/apps/files/composer/composer/autoload_classmap.php b/apps/files/composer/composer/autoload_classmap.php
index 868014ecfe7..686f1b6cd5e 100644
--- a/apps/files/composer/composer/autoload_classmap.php
+++ b/apps/files/composer/composer/autoload_classmap.php
@@ -27,7 +27,9 @@ return array(
'OCA\\Files\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir . '/../lib/Collaboration/Resources/Listener.php',
'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir . '/../lib/Collaboration/Resources/ResourceProvider.php',
+ 'OCA\\Files\\Command\\Delete' => $baseDir . '/../lib/Command/Delete.php',
'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir . '/../lib/Command/DeleteOrphanedFiles.php',
+ 'OCA\\Files\\Command\\Get' => $baseDir . '/../lib/Command/Get.php',
'OCA\\Files\\Command\\RepairTree' => $baseDir . '/../lib/Command/RepairTree.php',
'OCA\\Files\\Command\\Scan' => $baseDir . '/../lib/Command/Scan.php',
'OCA\\Files\\Command\\ScanAppData' => $baseDir . '/../lib/Command/ScanAppData.php',
diff --git a/apps/files/composer/composer/autoload_static.php b/apps/files/composer/composer/autoload_static.php
index 0946a5c39c2..5ce8d048b38 100644
--- a/apps/files/composer/composer/autoload_static.php
+++ b/apps/files/composer/composer/autoload_static.php
@@ -42,7 +42,9 @@ class ComposerStaticInitFiles
'OCA\\Files\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/Listener.php',
'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/ResourceProvider.php',
+ 'OCA\\Files\\Command\\Delete' => __DIR__ . '/..' . '/../lib/Command/Delete.php',
'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__ . '/..' . '/../lib/Command/DeleteOrphanedFiles.php',
+ 'OCA\\Files\\Command\\Get' => __DIR__ . '/..' . '/../lib/Command/Get.php',
'OCA\\Files\\Command\\RepairTree' => __DIR__ . '/..' . '/../lib/Command/RepairTree.php',
'OCA\\Files\\Command\\Scan' => __DIR__ . '/..' . '/../lib/Command/Scan.php',
'OCA\\Files\\Command\\ScanAppData' => __DIR__ . '/..' . '/../lib/Command/ScanAppData.php',
diff --git a/core/Command/Info/Delete.php b/apps/files/lib/Command/Delete.php
index 867938b03e2..c05fa573ab3 100644
--- a/core/Command/Info/Delete.php
+++ b/apps/files/lib/Command/Delete.php
@@ -21,8 +21,9 @@ declare(strict_types=1);
*
*/
-namespace OC\Core\Command\Info;
+namespace OCA\Files\Command;
+use OC\Core\Command\Info\FileUtils;
use OCA\Files_Sharing\SharedStorage;
use OCP\Files\Folder;
use Symfony\Component\Console\Command\Command;
@@ -43,7 +44,7 @@ class Delete extends Command {
protected function configure(): void {
$this
- ->setName('info:file:delete')
+ ->setName('files:delete')
->setDescription('Delete a file or folder')
->addArgument('file', InputArgument::REQUIRED, "File id or path")
->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for configuration and don't output any warnings");
diff --git a/core/Command/Info/Get.php b/apps/files/lib/Command/Get.php
index f3ab5dde58a..2b6c43d792f 100644
--- a/core/Command/Info/Get.php
+++ b/apps/files/lib/Command/Get.php
@@ -21,15 +21,14 @@ declare(strict_types=1);
*
*/
-namespace OC\Core\Command\Info;
+namespace OCA\Files\Command;
+use OC\Core\Command\Info\FileUtils;
use OCP\Files\File;
-use OCP\Util;
use Symfony\Component\Console\Command\Command;
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 Get extends Command {
@@ -42,15 +41,15 @@ class Get extends Command {
protected function configure(): void {
$this
- ->setName('info:file:get')
+ ->setName('files:get')
->setDescription('Get the contents of a file')
->addArgument('file', InputArgument::REQUIRED, "File id or path")
- ->addOption('output', 'o', InputOption::VALUE_REQUIRED, "Target file to output to");
+ ->addArgument('output', InputArgument::OPTIONAL, "Target file to output to, defaults to STDOUT");
}
public function execute(InputInterface $input, OutputInterface $output): int {
$fileInput = $input->getArgument('file');
- $outputName = $input->getOption('output');
+ $outputName = $input->getArgument('output');
$node = $this->fileUtils->getNode($fileInput);
if (!$node) {
@@ -63,13 +62,13 @@ class Get extends Command {
if ($outputName === null && $isTTY && $node->getMimePart() !== 'text') {
$output->writeln([
"<error>Warning: Binary output can mess up your terminal</error>",
- " Use '--output STDOUT' to output it to the terminal anyway",
- " Or '--output <FILE>' to save to a file instead"
+ " Use <info>occ files:get $fileInput -</info> to output it to the terminal anyway",
+ " Or <info>occ files:get $fileInput <FILE></info> to save to a file instead"
]);
return 1;
}
$source = $node->fopen('r');
- $target = (!$outputName || strtolower($outputName) === 'stdout') ? STDOUT : fopen($outputName, 'w');
+ $target = (!$outputName || strtolower($outputName) === '-') ? STDOUT : fopen($outputName, 'w');
stream_copy_to_stream($source, $target);
return 0;
} else {
diff --git a/core/register_command.php b/core/register_command.php
index dfbaac86551..8f600d7b894 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -105,8 +105,6 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
$application->add(\OC::$server->get(OC\Core\Command\Info\File::class));
$application->add(\OC::$server->get(OC\Core\Command\Info\Space::class));
- $application->add(\OC::$server->get(OC\Core\Command\Info\Get::class));
- $application->add(\OC::$server->get(OC\Core\Command\Info\Delete::class));
$application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig())));
$application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->get(LoggerInterface::class)));