diff --git a/app/console b/app/console
index dd14b19..b1e12fb 100755
--- a/app/console
+++ b/app/console
@@ -5,6 +5,7 @@ use Gist\Command\CreateCommand;
use Gist\Command\ListCommand;
use Gist\Command\UpdateCommand;
use Gist\Command\StatsCommand;
+use Gist\Command\DeleteCommand;
use Gist\Command\UserCreateCommand;
use Gist\Command\Migration\UpgradeTo1p4p1Command;
@@ -13,6 +14,7 @@ $app = require __DIR__.'/bootstrap.php';
$app['console']->add(new CreateCommand());
$app['console']->add(new ListCommand());
$app['console']->add(new UpdateCommand());
+$app['console']->add(new DeleteCommand());
$app['console']->add(new StatsCommand());
$app['console']->add(new UserCreateCommand());
$app['console']->add(new UpgradeTo1p4p1Command());
diff --git a/src/Gist/Command/DeleteCommand.php b/src/Gist/Command/DeleteCommand.php
new file mode 100644
index 0000000..ec0ca31
--- /dev/null
+++ b/src/Gist/Command/DeleteCommand.php
@@ -0,0 +1,48 @@
+
+ */
+class DeleteCommand extends Command
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('delete')
+ ->setDescription('Delete a gist using the API')
+ ->addOption('gist', null, InputOption::VALUE_REQUIRED, 'Id or File of the gist')
+ ->setHelp(<<<'EOF'
+Provides a client to delete a gist using the API.
+
+Arguments:
+ none.
+
+Options:
+ --gist
+ Defines the Gist to delete by using its Id or its File
+EOF
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $result = $this->getSilexApplication()['api_client']->delete($input->getOption('gist'));
+
+ $output->writeln(empty($result['error']) ? 'OK' : 'An error occured.');
+ }
+}
diff --git a/src/Gist/Command/ListCommand.php b/src/Gist/Command/ListCommand.php
index a0c99aa..4c2f1f9 100644
--- a/src/Gist/Command/ListCommand.php
+++ b/src/Gist/Command/ListCommand.php
@@ -26,7 +26,7 @@ class ListCommand extends Command
{
$this
->setName('list')
- ->setDescription('Listing gists using the API');
+ ->setDescription('List gists using the API');
}
/**
diff --git a/src/Gist/Controller/ApiController.php b/src/Gist/Controller/ApiController.php
index 3013bab..842bf99 100644
--- a/src/Gist/Controller/ApiController.php
+++ b/src/Gist/Controller/ApiController.php
@@ -216,7 +216,7 @@ class ApiController extends Controller
}
if (false === $request->isMethod('post')) {
- // return $this->invalidMethodResponse('POST method is required.');
+ return $this->invalidMethodResponse('POST method is required.');
}
$user = $app['user.provider']->loadUserByApiKey($apiKey);