浏览代码

Adding access to input's options and arguments used by the triggers

François Pluchino 13 年之前
父节点
当前提交
b147210ff4
共有 2 个文件被更改,包括 65 次插入1 次删除
  1. 32 0
      src/Composer/IO/ConsoleIO.php
  2. 33 1
      src/Composer/IO/IOInterface.php

+ 32 - 0
src/Composer/IO/ConsoleIO.php

@@ -46,6 +46,38 @@ class ConsoleIO implements IOInterface
         $this->helperSet = $helperSet;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public function getArguments()
+    {
+        return $this->input->getArguments();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public function getArgument($name)
+    {
+        return $this->input->getArgument($name);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public function getOptions()
+    {
+        return $this->input->getOptions();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public function getOption($name)
+    {
+        return $this->input->getOption($name);
+    }
+
     /**
      * {@inheritDoc}
      */

+ 33 - 1
src/Composer/IO/IOInterface.php

@@ -18,7 +18,39 @@ namespace Composer\IO;
  * @author François Pluchino <francois.pluchino@opendisplay.com>
  */
 interface IOInterface
-{
+{
+    /**
+     * Returns all the given arguments merged with the default values.
+     *
+     * @return array
+     */
+    function getArguments();
+
+    /**
+     * Gets argument by name.
+     *
+     * @param string $name The name of the argument
+     *
+     * @return mixed
+     */
+    function getArgument($name);
+
+    /**
+     * Returns all the given options merged with the default values.
+     *
+     * @return array
+     */
+    function getOptions();
+
+    /**
+     * Gets an option by name.
+     *
+     * @param string $name The name of the option
+     *
+     * @return mixed
+     */
+    function getOption($name);
+
     /**
      * Is this input means interactive?
      *