add description for all commands
[shpub.git] / src / shpub / Command / Note.php
index de6794890711f4d73fd9354c7583ff06370a683e..2a911c905560c9496abf3ca3ccb053270900ea17 100644 (file)
@@ -3,19 +3,11 @@ namespace shpub;
 
 class Command_Note extends Command_AbstractProps
 {
-    /**
-     * @var Config
-     */
-    protected $cfg;
-
-    public function __construct($cfg)
-    {
-        $this->cfg = $cfg;
-    }
-
     public static function opts(\Console_CommandLine $optParser)
     {
         $cmd = $optParser->addCommand('note');
+        $cmd->description = 'Create a note';
+        static::addOptHtml($cmd);
         static::optsGeneric($cmd);
         $cmd->addArgument(
             'text',
@@ -30,14 +22,14 @@ class Command_Note extends Command_AbstractProps
     public function run(\Console_CommandLine_Result $cmdRes)
     {
         $req = new Request($this->cfg->host, $this->cfg);
-        $req->req->addPostParameter('h', 'entry');
-        $req->req->addPostParameter('content', $cmdRes->args['text']);
+        $req->setType('entry');
+        $req->addContent($cmdRes->args['text'], $cmdRes->options['html']);
         $this->handleGenericOptions($cmdRes, $req);
 
         $res = $req->send();
         $postUrl = $res->getHeader('Location');
-        echo "Post created at server\n";
-        echo $postUrl . "\n";
+        Log::info('Post created at server');
+        Log::msg($postUrl);
     }
 }
 ?>