add description for all commands
[shpub.git] / src / shpub / Command / Delete.php
index fec839fe94d89509d0d6db2f8fae59ff325da271..cd975000e65585694bb1537c876b1c5fdbced94c 100644 (file)
@@ -3,19 +3,11 @@ namespace shpub;
 
 class Command_Delete extends Command_AbstractProps
 {
-    /**
-     * @var Config
-     */
-    protected $cfg;
-
-    public function __construct($cfg)
-    {
-        $this->cfg = $cfg;
-    }
-
     public static function opts(\Console_CommandLine $optParser)
     {
         $cmd = $optParser->addCommand('delete');
+        $cmd->description = 'Delete an existing post';
+        static::addOptJson($cmd);
         $cmd->addArgument(
             'url',
             [
@@ -33,8 +25,9 @@ class Command_Delete extends Command_AbstractProps
         }
 
         $req = new Request($this->cfg->host, $this->cfg);
-        $req->req->addPostParameter('action', 'delete');
-        $req->req->addPostParameter('url', $url);
+        $this->handleOptJson($cmdRes, $req);
+        $req->setAction('delete');
+        $req->setUrl($url);
 
         $res = $req->send();
         Log::info('Post deleted from server');