git.cweiske.de
/
shpub.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add "json" option
[shpub.git]
/
src
/
shpub
/
Command
/
Note.php
diff --git
a/src/shpub/Command/Note.php
b/src/shpub/Command/Note.php
index a60422aad16479498883b2d7b79523aaeaa9b250..c7683f3b7a289f5052e571b2e3754b0ba6e77db7 100644
(file)
--- a/
src/shpub/Command/Note.php
+++ b/
src/shpub/Command/Note.php
@@
-1,21
+1,12
@@
<?php
namespace shpub;
<?php
namespace shpub;
-class Command_Note
+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');
public static function opts(\Console_CommandLine $optParser)
{
$cmd = $optParser->addCommand('note');
+ static::optsGeneric($cmd);
$cmd->addArgument(
'text',
[
$cmd->addArgument(
'text',
[
@@
-26,20
+17,17
@@
class Command_Note
);
}
);
}
- public function run(
$command
)
+ public function run(
\Console_CommandLine_Result $cmdRes
)
{
{
- $data = [
- 'h' => 'entry',
- 'content' => $command->args['text'],
- ];
-
- $body = http_build_query($data);
-
$req = new Request($this->cfg->host, $this->cfg);
$req = new Request($this->cfg->host, $this->cfg);
- $res = $req->send($body);
+ $req->setType('entry');
+ $req->addProperty('content', $cmdRes->args['text']);
+ $this->handleGenericOptions($cmdRes, $req);
+
+ $res = $req->send();
$postUrl = $res->getHeader('Location');
$postUrl = $res->getHeader('Location');
-
echo "Post created at server\n"
;
-
echo $postUrl . "\n"
;
+
Log::info('Post created at server')
;
+
Log::msg($postUrl)
;
}
}
?>
}
}
?>