X-Git-Url: https://git.cweiske.de/shpub.git/blobdiff_plain/e53ff38824e76ee587c3c7b7fffebc551933e761..d78790c613a4363aa0566c357c4444e17582dc23:/src/shpub/Command/Reply.php diff --git a/src/shpub/Command/Reply.php b/src/shpub/Command/Reply.php index cb09ba7..622361a 100644 --- a/src/shpub/Command/Reply.php +++ b/src/shpub/Command/Reply.php @@ -4,15 +4,34 @@ namespace shpub; class Command_Reply { /** - * @var Config_Host + * @var Config */ - protected $host; + protected $cfg; - public function __construct($host) + public function __construct($cfg) { - $this->host = $host; + $this->cfg = $cfg; } + public static function opts(\Console_CommandLine $optParser) + { + $cmd = $optParser->addCommand('reply'); + $cmd->addArgument( + 'url', + [ + 'optional' => false, + 'description' => 'URL that is replied to', + ] + ); + $cmd->addArgument( + 'text', + [ + 'optional' => false, + 'multiple' => true, + 'description' => 'Reply text', + ] + ); + } public function run($url, $text) { $url = Validator::url($url, 'url'); @@ -28,7 +47,7 @@ class Command_Reply ] ); - $req = new Request($this->host); + $req = new Request($this->cfg->host, $this->cfg); $res = $req->send($body); $postUrl = $res->getHeader('Location'); echo "Reply created at server\n";