X-Git-Url: https://git.cweiske.de/shpub.git/blobdiff_plain/c40d4e6c6349b98c90e8bbb79b361e08e60c0dba..932bcd4bc95da51a819b099d284b7d25d4d50f05:/src/shpub/Command/Delete.php diff --git a/src/shpub/Command/Delete.php b/src/shpub/Command/Delete.php new file mode 100644 index 0000000..fec839f --- /dev/null +++ b/src/shpub/Command/Delete.php @@ -0,0 +1,43 @@ +cfg = $cfg; + } + + public static function opts(\Console_CommandLine $optParser) + { + $cmd = $optParser->addCommand('delete'); + $cmd->addArgument( + 'url', + [ + 'optional' => false, + 'description' => 'URL to remove', + ] + ); + } + + public function run(\Console_CommandLine_Result $cmdRes) + { + $url = Validator::url($cmdRes->args['url'], 'url'); + if ($url === false) { + exit(10); + } + + $req = new Request($this->cfg->host, $this->cfg); + $req->req->addPostParameter('action', 'delete'); + $req->req->addPostParameter('url', $url); + + $res = $req->send(); + Log::info('Post deleted from server'); + } +} +?>