X-Git-Url: https://git.cweiske.de/shpub.git/blobdiff_plain/932bcd4bc95da51a819b099d284b7d25d4d50f05..6c791f2d0c159d56c570802c8d9bd3612262aa9e:/src/shpub/Command/Delete.php diff --git a/src/shpub/Command/Delete.php b/src/shpub/Command/Delete.php index fec839f..cd97500 100644 --- a/src/shpub/Command/Delete.php +++ b/src/shpub/Command/Delete.php @@ -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');