reply support
[shpub.git] / src / shpub / Cli.php
index 823e2978d87fadeabf2b202f74241214575f04fe..5b46fcdd1f80748c7ee7dd67c025068390d8112b 100644 (file)
@@ -23,14 +23,31 @@ class Cli
                 $cmd->run(
                     $res->command->args['server'],
                     $res->command->args['user'],
-                    $res->command->args['key']
+                    $res->command->args['key'],
+                    $res->command->options['force']
                 );
                 break;
+
+            case 'server':
+                $cmd = new Command_Server($this->cfg);
+                $cmd->run($res->command->options['verbose']);
+                break;
+
             case 'like':
                 $this->requireValidHost();
                 $cmd = new Command_Like($this->cfg->host);
                 $cmd->run($res->command->args['url']);
                 break;
+
+            case 'reply':
+                $this->requireValidHost();
+                $cmd = new Command_Reply($this->cfg->host);
+                $cmd->run(
+                    $res->command->args['url'],
+                    implode(' ', $res->command->args['text'])
+                );
+                break;
+
             default:
                 var_dump($this->cfg->host, $res);
                 Log::err('FIXME');
@@ -109,6 +126,16 @@ class Cli
         );
 
         $cmd = $optParser->addCommand('connect');
+        $cmd->addOption(
+            'force',
+            array(
+                'short_name'  => '-f',
+                'long_name'   => '--force-update',
+                'description' => 'Force token update if token already available',
+                'action'      => 'StoreTrue',
+                'default'     => false,
+            )
+        );
         $cmd->addArgument(
             'server',
             [
@@ -131,6 +158,18 @@ class Cli
             ]
         );
 
+        $cmd = $optParser->addCommand('server');
+        $cmd->addOption(
+            'verbose',
+            array(
+                'short_name'  => '-v',
+                'long_name'   => '--verbose',
+                'description' => 'Show more server infos',
+                'action'      => 'StoreTrue',
+                'default'     => false,
+            )
+        );
+
         //$cmd = $optParser->addCommand('post');
         $cmd = $optParser->addCommand('reply');
         $cmd->addArgument(
@@ -144,6 +183,7 @@ class Cli
             'text',
             [
                 'optional'    => false,
+                'multiple'    => true,
                 'description' => 'Reply text',
             ]
         );
@@ -170,6 +210,8 @@ class Cli
                 'Server data incomplete. "shpub connect" first.'
             );
         }
+
+        $this->cfg->host->loadEndpoints();
     }
 }
 ?>