move constructor to command base class
[shpub.git] / src / shpub / Command / AbstractProps.php
index d1ef2189286b8064bbb692fac61d1865ada70339..6d7ef3b8c27c346ca87f0cff8feedafbe56a70ea 100644 (file)
@@ -6,6 +6,16 @@ namespace shpub;
  */
 class Command_AbstractProps
 {
+    /**
+     * @var Config
+     */
+    protected $cfg;
+
+    public function __construct($cfg)
+    {
+        $this->cfg = $cfg;
+    }
+
     public static function optsGeneric(\Console_CommandLine_Command $cmd)
     {
         $cmd->addOption(
@@ -40,6 +50,17 @@ class Command_AbstractProps
                 'default'     => null,
             )
         );
+        $cmd->addOption(
+            'slug',
+            array(
+                'short_name'  => '-s',
+                'long_name'   => '--slug',
+                'description' => 'URL path',
+                'help_name'   => 'PATH',
+                'action'      => 'StoreString',
+                'default'     => null,
+            )
+        );
         $cmd->addOption(
             'syndication',
             array(
@@ -77,6 +98,11 @@ class Command_AbstractProps
                 'category', $cmdRes->options['categories']
             );
         }
+        if ($cmdRes->options['slug'] !== null) {
+            $req->req->addPostParameter(
+                'slug', $cmdRes->options['slug']
+            );
+        }
         if (count($cmdRes->options['syndication'])) {
             $req->addPostParameter(
                 'syndication', $cmdRes->options['syndication']