From b147210ff4d8d301d048c0f093a60750611c5122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pluchino?= Date: Tue, 24 Jan 2012 18:10:22 +0100 Subject: [PATCH] Adding access to input's options and arguments used by the triggers --- src/Composer/IO/ConsoleIO.php | 32 +++++++++++++++++++++++++++++++ src/Composer/IO/IOInterface.php | 34 ++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/Composer/IO/ConsoleIO.php b/src/Composer/IO/ConsoleIO.php index 0169d2908..3ef514564 100644 --- a/src/Composer/IO/ConsoleIO.php +++ b/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} */ diff --git a/src/Composer/IO/IOInterface.php b/src/Composer/IO/IOInterface.php index 1b84daab7..cb9c74e24 100644 --- a/src/Composer/IO/IOInterface.php +++ b/src/Composer/IO/IOInterface.php @@ -18,7 +18,39 @@ namespace Composer\IO; * @author François Pluchino */ 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? *