Feature #4426 » 4426_v1.patch

Bastian Waidelich, 2009-09-29 16:43

View differences:

Configuration/FLOW3.yaml (working copy)
7 7
# Please refer to the default configuration file or the FLOW3 manual for #
8 8
# possible configuration options.                                        #
9 9
#                                                                        #
10

  
11
cli:
12
  commandSets:
13
    package:
14
      controller: F3\FLOW3\Package\Controller\ManagerController
15
      actions: [listAvailable, listActive, create, activate, deactivate, delete]
16
    cache:
17
      controller: F3\FLOW3\Cache\Controller\ManagerController
18
      actions: [flush]
19
    testing:
20
      controller: F3\Testing\Controller\CLIController
21
      actions: [run]
22
    kickstart:
23
      controller: F3\Kickstart\Controller\KickstartController
24
      actions: [generatePackage]
flow3 (working copy)
31 31

  
32 32
# Configuration
33 33
PHP='/usr/bin/env php'
34
BOOTSTRAP='Packages/Framework/FLOW3/Scripts/FLOW3.php'
34
CLI='Packages/Framework/FLOW3/Scripts/FLOW3CLI.php'
35 35

  
36
FLOW3ROOTPATH="$(dirname "$(test -L "$0" && readlink "$0" || echo "$0")")"
37
FLOW3WEBPATH="$FLOW3ROOTPATH/Web"
36
FLOW3_CONTEXT="Development"
37
FLOW3_ROOTPATH="$(dirname "$(test -L "$0" && readlink "$0" || echo "$0")")"
38
FLOW3_WEBPATH="$FLOW3_ROOTPATH/Web"
38 39

  
39
printUsage () {
40
	echo 'FLOW3 Command Line Interface'
41
	echo ''
42
	echo 'usage: flow3 <options> <command>'
43
	echo ''
44
	echo 'Options:'
45
	echo ''
46
	echo '  -h, --help        - print this message'
47
	echo '  -p, --production  - execute in production context'
48
	echo ''
49
	echo 'Available commands:'
50
	echo ''
51
	echo '  package list available           - list available packages'
52
	echo '  package list active              - list active packages'
53
	echo '  package create <package-key>     - create a new package'
54
	echo '  package activate <package-key>   - activate a package'
55
	echo '  package deactivate <package-key> - deactivate a package'
56
	echo '  package delete <package-key>     - delete a package'
57
	echo ''
58
	echo '  cache flush                      - flush all caches'
59
	echo ''
60
	echo '  testing <package-key> <output-directory> [<testcase> [<coverage-directory>]] '
61
	echo '                                   - run unit tests'
62
	echo '                                     <package-key> Package to test (mandatory)'
63
	echo '                                     <output-directory> path to write the logfile.xml (mandatory)'
64
	echo '                                     <testcase> only run this testcase (optional)'
65
	echo '                                     <coverage-directory> path to write the clover.xml (optional)'
66
	echo ''
67
	echo '  kickstart package <package-key>'
68
	echo '                                   - kickstart a new package, including a standard controller'
69
	echo '                                     <package-key> Package for the controller (mandatory)'
70
	echo ''
71
	echo '  kickstart controller <package-key> [<controller-name>]'
72
	echo '                                   - generate a controller'
73
	echo '                                     <package-key> Package for the controller (mandatory)'
74
	echo '                                     <controller-name> Name of the controller, can also be a comma separated list of multiple controller names (optional)'
75
	echo ''
76
	echo '  kickstart model <package-key> <model-name>'
77
	echo '                                   - generate a model'
78
	echo '                                     <package-key> Package for the model (mandatory)'
79
	echo '                                     <model-name> Name of the model (mandatory)'
80
	echo ''
81
	echo '  kickstart repository <package-key> [<model-name>]'
82
	echo '                                   - generate a repository'
83
	echo '                                     <package-key> Package for the controller (mandatory)'
84
	echo '                                     <model-name> Name of the model the repository is for (mandatory)'
85
	echo ''
86
	exit 1
87
}
88

  
89
# check minimum argument count
90
if [ $# -lt 2 ]; then
91
	printUsage
92
fi
93

  
94
CONTEXT='Development'
95
PACKAGE=''
96
SUBPACKAGES=''
97
CONTROLLER=''
98
ACTION=''
99
ARGUMENTS=''
100

  
101

  
102
# parse argument list
103
while [ $# -ge 1 ]; do
104
	case $1 in
105
	help|--help|-h)
106
		printUsage
107
		;;
108

  
109
	--production|-p)
110
		CONTEXT='Production'
111
		;;
112

  
113
	package)
114
		PACKAGE='FLOW3'
115
		SUBPACKAGES='Package'
116
		CONTROLLER='Manager'
117
		shift
118
		case $1 in
119
		create|activate|deactivate|delete)
120
			if [ $# -ne 2 ]; then
121
				echo 'Please specify a package-key'
122
				echo
123
				printUsage
124
			else
125
				ACTION=$1
126
				shift
127
				ARGUMENTS="--package-key=$1"
128
			fi
129
			;;
130
		list)
131
			shift
132
			ACTION="list$1"
133
		esac
134
		;;
135

  
136
	testing)
137
		PACKAGE='Testing'
138
		CONTROLLER='CLI'
139
		ACTION='run'
140
		shift
141
		if [ $# -lt 2 ]; then
142
			echo 'Please specify a package-key and output-directory'
143
			echo
144
			printUsage
145
		else
146
			ARGUMENTS="--package-key=$1"
147
			shift
148
			ARGUMENTS="$ARGUMENTS --output-directory=$1"
149

  
150
			if [ $# -gt 1 ]; then
151
				shift
152
				ARGUMENTS="$ARGUMENTS --testcase=$1"
153
			fi
154
			if [ $# -gt 1 ]; then
155
				shift
156
				ARGUMENTS="$ARGUMENTS --coverage-directory=$1"
157
			fi
158
		fi
159
		;;
160

  
161
	cache)
162
		shift
163
		if [ $# -lt 1 ]; then
164
			echo 'Please specify a subcommand'
165
			echo
166
			printUsage
167
		else
168
			if [ "$1" = 'flush' ]; then
169
				PACKAGE='FLOW3'
170
				SUBPACKAGES='Cache'
171
				CONTROLLER='Manager'
172
				ACTION='flush'
173
			fi
174
		fi
175
		;;
176

  
177
	kickstart)
178
		PACKAGE='Kickstart'
179
		CONTROLLER='Kickstart'
180
		shift
181
		if [ $# -lt 2 ]; then
182
			echo 'Please specify a package-key'
183
			echo
184
			printUsage
185
		else
186
			if [ "$1" = 'package' ]; then
187
				shift
188
				ACTION='generatePackage'
189
				ARGUMENTS="--package-key=$1"
190
			fi
191
			if [ "$1" = 'controller' ]; then
192
				shift
193
				ACTION='generateController'
194
				ARGUMENTS="--package-key=$1"
195
				if [ $# -gt 1 ]; then
196
					shift
197
					ARGUMENTS="$ARGUMENTS --controller-name=$1"
198
				fi
199
			fi
200
			if [ "$1" = 'model' ]; then
201
				shift
202
				ACTION='generateModel'
203
				ARGUMENTS="--package-key=$1"
204
				if [ $# -gt 1 ]; then
205
					shift
206
					ARGUMENTS="$ARGUMENTS --model-name=$1"
207
					while [ $# -ge 1 ]; do
208
						shift
209
						ARGUMENTS="$ARGUMENTS $1"
210
					done
211
				fi
212
			fi
213
			if [ "$1" = 'repository' ]; then
214
				shift
215
				ACTION='generateRepository'
216
				ARGUMENTS="--package-key=$1"
217
				if [ $# -gt 1 ]; then
218
					shift
219
					ARGUMENTS="$ARGUMENTS --model-name=$1"
220
					while [ $# -ge 1 ]; do
221
						shift
222
						ARGUMENTS="$ARGUMENTS $1"
223
					done
224
				fi
225
			fi
226
		fi
227
		;;
228

  
229
	*)
230
		PACKAGE=''
231
		CONTROLLER=''
232
		ACTION=''
233
		ARGUMENTS=''
234
		;;
235

  
236
	esac
237
	shift
238
done
239

  
240

  
241

  
242
if [ "$PACKAGE" = '' -o "$CONTROLLER" = '' -o "$ACTION" = '' ]; then
243
	printUsage
244
fi
245

  
246

  
247
# echo P $PACKAGE
248
# echo S $SUBPACKAGES
249
# echo C $CONTROLLER
250
# echo A $ACTION
251
# echo A $ARGUMENTS
252

  
253
# execute the command
254
# echo FLOW3_CONTEXT=$CONTEXT $PHP $FLOW3ROOTPATH/$BOOTSTRAP $PACKAGE $SUBPACKAGES $CONTROLLER $ACTION $ARGUMENTS
255
FLOW3_CONTEXT=$CONTEXT FLOW3_ROOTPATH=$FLOW3ROOTPATH FLOW3_WEBPATH=$FLOW3WEBPATH $PHP "$FLOW3ROOTPATH/$BOOTSTRAP" $PACKAGE $SUBPACKAGES $CONTROLLER $ACTION $ARGUMENTS
40
$PHP "$FLOW3ROOTPATH/$CLI"
flow3.bat (revision 0)
1
@ECHO off
2
: ###############################################################################
3
: #
4
: # This script belongs to the FLOW3 framework.
5
: #
6
: # It is free software; you can redistribute it and/or modify it under
7
: # the terms of the GNU Lesser General Public License as published by the
8
: # Free Software Foundation, either version 3 of the License, or (at your
9
: # option) any later version.
10
: #
11
: # This script is distributed in the hope that it will be useful, but
12
: # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
13
: # TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
14
: # General Public License for more details.
15
: #
16
: # You should have received a copy of the GNU Lesser General Public
17
: # License along with the script.
18
: # If not, see http://www.gnu.org/licenses/lgpl.html
19
: #
20
: # The TYPO3 project - inspiring people to share!
21
: #
22
: ###############################################################################
23

  
24
: ##
25
: #
26
: # @package FLOW3
27
: # @author Bastian Waidelich <bastian@typo3.org>
28
: # @version $Id$
29
: # @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
: #
31

  
32
: # Configuration
33
SET PHP=C:/xampp/php/php.exe
34
SET CLI=Packages/Framework/FLOW3/Scripts/FLOW3CLI.php
35

  
36
SET FLOW3_CONTEXT=Development
37
SET FLOW3_ROOTPATH=.
38
SET FLOW3_WEBPATH=%FLOW3_ROOTPATH%/Web
39

  
40
%PHP% "%FLOW3_ROOTPATH%/%CLI%" "%~1" "%~2" "%~3" "%~4" "%~5"
Packages/Framework/FLOW3/Classes/CLI/Command/Command.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Command;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * CLI command
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 * @scope prototype
31
 */
32
class Command implements \F3\FLOW3\CLI\Command\CommandInterface {
33

  
34
	const PATTERN_MATCH_COMMANDNAME = '/^[A-Za-z][A-Za-z0-9_-]+$/';
35

  
36
	/**
37
	 * @var string command name
38
	 */
39
	protected $commandName = '';
40

  
41
	/**
42
	 * @var string sub command name
43
	 */
44
	protected $subCommandName = NULL;
45

  
46
	/**
47
	 * @var string description of this command
48
	 */
49
	protected $description = '';
50

  
51
	/**
52
	 * @var array registered arguments
53
	 */
54
	protected $registeredArguments = array();
55

  
56
	/**
57
	 * @var \Closure callback to be invoked on execution of the current command
58
	 */
59
	protected $onExecuteCallback;
60

  
61
	/**
62
	 * Constructor
63
	 *
64
	 * @param string $commandName the command name
65
	 * @param string $subCommandName the sub command name (optional)
66
	 * @param string $description description of this command (optional)
67
	 * @author Bastian Waidelich <bastian@typo3.org>
68
	 */
69
	public function __construct($commandName, $subCommandName = NULL, $description = '') {
70
		if (preg_match(self::PATTERN_MATCH_COMMANDNAME, $commandName) !== 1) {
71
			throw new \F3\FLOW3\CLI\Exception\InvalidCommandName('"' . $commandName . '" is not a valid command name.', 1254178133);
72
		}
73
		if ($subCommandName !== NULL && preg_match(self::PATTERN_MATCH_COMMANDNAME, $subCommandName) !== 1) {
74
			throw new \F3\FLOW3\CLI\Exception\InvalidSubCommandName('"' . $subCommandName . '" is not a valid sub command name.', 1254178137);
75
		}
76
		$this->commandName = $commandName;
77
		$this->subCommandName = $subCommandName;
78
		$this->description = $description;
79
	}
80

  
81
	/**
82
	 * Returns the command name
83
	 *
84
	 * @return string
85
	 * @api
86
	 * @author Bastian Waidelich <bastian@typo3.org>
87
	 */
88
	public function getCommandName() {
89
		return $this->commandName;
90
	}
91

  
92
	/**
93
	 * Returns the sub command name
94
	 *
95
	 * @return string
96
	 * @api
97
	 * @author Bastian Waidelich <bastian@typo3.org>
98
	 */
99
	public function getSubCommandName() {
100
		return $this->subCommandName;
101
	}
102

  
103
	/**
104
	 * If sub command name is not set, only the command name is returned.
105
	 * Otherwise command name and sub command name are returned, separated by a blank
106
	 *
107
	 * @return string
108
	 * @api
109
	 * @author Bastian Waidelich <bastian@typo3.org>
110
	 */
111
	public function getSignature() {
112
		$commandSignature = $this->commandName;
113
		if ($this->subCommandName !== NULL) {
114
			$commandSignature .= ' ' . $this->subCommandName;
115
		}
116
		return $commandSignature;
117
	}
118

  
119
	/**
120
	 * Returns description for this command
121
	 *
122
	 * @return string
123
	 * @api
124
	 * @author Bastian Waidelich <bastian@typo3.org>
125
	 */
126
	public function getDescription() {
127
		return $this->description;
128
	}
129

  
130
	/**
131
	 * Adds a new argument to this command
132
	 *
133
	 * @param \F3\FLOW3\CLI\Command\CommandArgumentInterface $commandArgument command argument to be registered
134
	 * @return void
135
	 * @api
136
	 * @author Bastian Waidelich <bastian@typo3.org>
137
	 */
138
	public function registerArgument(\F3\FLOW3\CLI\Command\CommandArgumentInterface $argument) {
139
		$argumentName = $argument->getName();
140
		if (isset($this->registeredArguments[$argumentName])) {
141
			throw new \F3\FLOW3\CLI\Exception\InvalidCommandArgument('An argument with the name "' . $argumentName . '" is already registered for this command.', 1254177667);
142
		}
143
		if ($argument->isRequired()) {
144
			foreach($this->registeredArguments as $registeredArgument) {
145
				if (!$registeredArgument->isRequired()) {
146
					throw new \F3\FLOW3\CLI\Exception\InvalidCommandArgument('You can\'t register required command arguments after optional arguments.', 1254152841);
147
				}
148
			}
149
		}
150
		$this->registeredArguments[$argumentName] = $argument;
151
	}
152

  
153
	/**
154
	 * returns all registered arguments
155
	 *
156
	 * @return array
157
	 * @api
158
	 * @author Bastian Waidelich <bastian@typo3.org>
159
	 */
160
	public function getRegisteredArguments() {
161
		return $this->registeredArguments;
162
	}
163

  
164
	/**
165
	 * Registers a callback that will be envoked when the command is executed
166
	 *
167
	 * @param \Closure $callback the callback to be invoked on execution of this command
168
	 * @return void
169
	 * @api
170
	 */
171
	public function onExecute(\Closure $callback) {
172
		$this->onExecuteCallback = $callback;
173
	}
174

  
175
	/**
176
	 * Executes this command
177
	 *
178
	 * @param array $arguments simple arguments array (keyless) to be passed to the command e.g. array('foo', 'bar')
179
	 * @return void
180
	 * @api
181
	 */
182
	public function execute(array $arguments = array()) {
183
		$purgedArguments = array();
184
		$index = 0;
185
		foreach($this->registeredArguments as $registeredArgument) {
186
			if (isset($arguments[$index])) {
187
				$purgedArguments[$registeredArgument->getName()] = $arguments[$index];
188
			} elseif ($registeredArgument->isRequired()) {
189
				throw new \F3\FLOW3\CLI\Exception\MissingArgument('Missing required argument "' . $registeredArgument->getName() . '".', 1254177164);
190
			}
191
			$index ++;
192
		}
193
		if ($this->onExecuteCallback instanceof \Closure) {
194
			call_user_func_array($this->onExecuteCallback, array($this, $purgedArguments));
195
		}
196
	}
197

  
198
}
199

  
200
?>
0 201

  
Packages/Framework/FLOW3/Classes/CLI/Command/CommandArgument.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Command;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * CLI command argument
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 * @scope prototype
31
 */
32
class CommandArgument implements \F3\FLOW3\CLI\Command\CommandArgumentInterface {
33

  
34
	const PATTERN_MATCH_ARGUMENTNAME = '/^[A-Za-z][A-Za-z0-9_-]+$/';
35

  
36
	/**
37
	 * @var string argument name
38
	 */
39
	protected $name = '';
40

  
41
	/**
42
	 * @var string argument description
43
	 */
44
	protected $description = '';
45

  
46
	/**
47
	 * @var boolean TRUE, if the argument is required
48
	 */
49
	protected $required = FALSE;
50

  
51
	/**
52
	 * Constructor
53
	 *
54
	 * @param string $name name of the argument
55
	 * @param string $description short description of the argument
56
	 * @param boolean $required TRUE if the argument should be required, otherwise FALSE
57
	 * @author Bastian Waidelich <bastian@typo3.org>
58
	 */
59
	public function __construct($name, $description = '', $required = FALSE) {
60
		if (preg_match(self::PATTERN_MATCH_ARGUMENTNAME, $name) !== 1) {
61
			throw new \F3\FLOW3\CLI\Exception\InvalidArgumentName('"' . $name . '" is not a valid argument name.', 1254180727);
62
		}
63
		$this->name = $name;
64
		$this->description = $description;
65
		$this->required = $required;
66
	}
67

  
68
	/**
69
	 * Returns the argument name
70
	 *
71
	 * @return string
72
	 * @api
73
	 * @author Bastian Waidelich <bastian@typo3.org>
74
	 */
75
	public function getName() {
76
		return $this->name;
77
	}
78

  
79
	/**
80
	 * Returns the description for this argument
81
	 *
82
	 * @return string
83
	 * @api
84
	 * @author Bastian Waidelich <bastian@typo3.org>
85
	 */
86
	public function getDescription() {
87
		return $this->description;
88
	}
89

  
90
	/**
91
	 * TRUE, if this argument is required
92
	 *
93
	 * @return string
94
	 * @api
95
	 * @author Bastian Waidelich <bastian@typo3.org>
96
	 */
97
	public function isRequired() {
98
		return $this->required;
99
	}
100

  
101
}
102

  
103
?>
0 104

  
Packages/Framework/FLOW3/Classes/CLI/Command/CommandArgumentInterface.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Command;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * Interface for CLI command arguments
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 */
31
interface CommandArgumentInterface {
32

  
33
	/**
34
	 * Returns the name of this argument
35
	 *
36
	 * @return string
37
	 */
38
	public function getName();
39

  
40
	/**
41
	 * Returns the description of this argument
42
	 *
43
	 * @return string
44
	 */
45
	public function getDescription();
46

  
47
	/**
48
	 * Returns FALSE if the argument is optional, otherwise FALSE
49
	 *
50
	 * @return boolean
51
	 */
52
	public function isRequired();
53

  
54
}
55

  
56
?>
0 57

  
Packages/Framework/FLOW3/Classes/CLI/Command/CommandInterface.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Command;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * Interface for CLI commands
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 */
31
interface CommandInterface {
32

  
33
	/**
34
	 * Adds a new argument to this command
35
	 *
36
	 * @param \F3\FLOW3\CLI\Command\CommandArgumentInterface $commandArgument command argument to be registered
37
	 * @return void
38
	 * @api
39
	 */
40
	public function registerArgument(\F3\FLOW3\CLI\Command\CommandArgumentInterface $commandArgument);
41

  
42
	/**
43
	 * Returns the Command name
44
	 *
45
	 * @return string
46
	 * @api
47
	 */
48
	public function getCommandName();
49

  
50
	/**
51
	 * Returns the Subcommand name
52
	 *
53
	 * @return string
54
	 * @api
55
	 */
56
	public function getSubCommandName();
57

  
58
	/**
59
	 * If sub command name is not set, only the command name is returned.
60
	 * Otherwise command name and sub command name are returned, separated by a blank
61
	 *
62
	 * @return string
63
	 * @api
64
	 */
65
	public function getSignature();
66

  
67
	/**
68
	 * Returns description for this command
69
	 *
70
	 * @return string
71
	 * @api
72
	 */
73
	public function getDescription();
74

  
75
	/**
76
	 * returns all registered arguments
77
	 *
78
	 * @return array
79
	 * @api
80
	 */
81
	public function getRegisteredArguments();
82

  
83
	/**
84
	 * Registers a callback that will be envoked when the command is executed
85
	 *
86
	 * @return void
87
	 * @api
88
	 */
89
	public function onExecute(\Closure $callback);
90

  
91
	/**
92
	 * Executes this command
93
	 *
94
	 * @param array $arguments simple arguments to be passed to the command e.g. array('foo', 'bar')
95
	 * @return void
96
	 * @api
97
	 */
98
	public function execute(array $arguments = array());
99
}
100

  
101
?>
0 102

  
Packages/Framework/FLOW3/Classes/CLI/Exception.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * A generic CLI Exception
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 */
31
class Exception extends \F3\FLOW3\Exception {
32

  
33
}
34

  
35
?>
0 36

  
Packages/Framework/FLOW3/Classes/CLI/Exception/InvalidArgumentName.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Exception;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * An invalid argument name Exception
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 */
31
class InvalidArgumentName extends \F3\FLOW3\CLI\Exception {
32

  
33
}
34

  
35
?>
0 36

  
Packages/Framework/FLOW3/Classes/CLI/Exception/InvalidCommandArgument.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Exception;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * An invalid command argument Exception
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 */
31
class InvalidCommandArgument extends \F3\FLOW3\CLI\Exception {
32

  
33
}
34

  
35
?>
0 36

  
Packages/Framework/FLOW3/Classes/CLI/Exception/InvalidCommandName.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Exception;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * An invalid command name Exception
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 */
31
class InvalidCommandName extends \F3\FLOW3\CLI\Exception {
32

  
33
}
34

  
35
?>
0 36

  
Packages/Framework/FLOW3/Classes/CLI/Exception/InvalidInput.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Exception;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * An invalid input Exception
27
 * That is thrown, if no matching command could be found for a given input
28
 *
29
 * @version $Id$
30
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
31
 */
32
class InvalidInput extends \F3\FLOW3\CLI\Exception {
33

  
34
}
35

  
36
?>
0 37

  
Packages/Framework/FLOW3/Classes/CLI/Exception/InvalidSubCommandName.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Exception;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * An invalid sub command name Exception
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 */
31
class InvalidSubCommandName extends \F3\FLOW3\CLI\Exception {
32

  
33
}
34

  
35
?>
0 36

  
Packages/Framework/FLOW3/Classes/CLI/Exception/MissingArgument.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI\Exception;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * An missing command argument Exception
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 */
31
class MissingArgument extends \F3\FLOW3\CLI\Exception {
32

  
33
}
34

  
35
?>
0 36

  
Packages/Framework/FLOW3/Classes/CLI/Host.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3
namespace F3\FLOW3\CLI;
4

  
5
/*                                                                        *
6
 * This script belongs to the FLOW3 framework.                            *
7
 *                                                                        *
8
 * It is free software; you can redistribute it and/or modify it under    *
9
 * the terms of the GNU Lesser General Public License as published by the *
10
 * Free Software Foundation, either version 3 of the License, or (at your *
11
 * option) any later version.                                             *
12
 *                                                                        *
13
 * This script is distributed in the hope that it will be useful, but     *
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
15
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
16
 * General Public License for more details.                               *
17
 *                                                                        *
18
 * You should have received a copy of the GNU Lesser General Public       *
19
 * License along with the script.                                         *
20
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
21
 *                                                                        *
22
 * The TYPO3 project - inspiring people to share!                         *
23
 *                                                                        */
24

  
25
/**
26
 * Command Line Interface host
27
 *
28
 * @version $Id$
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
30
 * @scope prototype
31
 */
32
class Host {
33

  
34
	/**
35
	 * @var array registered commands
36
	 */
37
	protected $registeredCommands = array();
38

  
39
	/**
40
	 * returns registered commands
41
	 *
42
	 * @return array
43
	 * @api
44
	 * @author Bastian Waidelich <bastian@typo3.org>
45
	 */
46
	public function getRegisteredCommands() {
47
		return $this->registeredCommands;
48
	}
49

  
50
	/**
51
	 * registers a new command
52
	 *
53
	 * @param \F3\FLOW3\CLI\CommandInterface $command
54
	 * @return void
55
	 * @api
56
	 * @author Bastian Waidelich <bastian@typo3.org>
57
	 */
58
	public function registerCommand(\F3\FLOW3\CLI\Command\CommandInterface $command) {
59
		foreach($this->registeredCommands as $registeredCommand) {
60
			if ($registeredCommand->getSignature() === $command->getSignature()) {
61
				throw new \F3\FLOW3\CLI\Exception('A command with the signature "' . $command->getSignature() . '" has already been registered.', 1254151895);
62
			}
63
		}
64
		$this->registeredCommands[] = $command;
65
	}
66

  
67
	/**
68
	 * Outputs given text to the console
69
	 *
70
	 * @param string $text string to be printed
71
	 * @return void
72
	 * @api
73
	 * @author Bastian Waidelich <bastian@typo3.org>
74
	 */
75
	public function output($text) {
76
		print $text;
77
	}
78

  
79
	/**
80
	 * Outputs given text to the console and appends a line-break
81
	 *
82
	 * @param string $text string to be printed
83
	 * @return void
84
	 * @api
85
	 * @author Bastian Waidelich <bastian@typo3.org>
86
	 */
87
	public function outputLine($text = '') {
88
		$this->output($text . PHP_EOL);
89
	}
90

  
91
	/**
92
	 * Prints available commands and their arguments including description to the console
93
	 *
94
	 * @return void
95
	 * @api
96
	 * @author Bastian Waidelich <bastian@typo3.org>
97
	 * @see getHelp()
98
	 */
99
	public function outputHelp() {
100
		$this->output($this->getHelp());
101
	}
102

  
103
	/**
104
	 * Returns available commands and their arguments including description
105
	 * formatted to output to the console
106
	 *
107
	 * @return string formatted list of registered commands and command arguments
108
	 * @author Bastian Waidelich <bastian@typo3.org>
109
	 */
110
	protected function getHelp() {
111
		$output = '';
112
		$lastCommandName = NULL;
113
		foreach($this->registeredCommands as $command) {
114
			if ($lastCommandName !== NULL && $lastCommandName !== $command->getCommandName()) {
115
				$output .= PHP_EOL;
116
			}
117
			$output .= $command->getSignature();
118
			$arguments = $command->getRegisteredArguments();
119
			if (count($arguments) > 0) {
120
				$argumentSignatures = array();
121
				foreach($arguments as $argument) {
122
					$argumentSignature = '<' . $argument->getName() . '>';
123
					if (!$argument->isRequired()) {
124
						$argumentSignature = '[' . $argumentSignature . ']';
125
					}
126
					$argumentSignatures[] = $argumentSignature;
127
				}
128
				$output .= ' ' . implode(' ', $argumentSignatures);
129
			}
130
			$output .= PHP_EOL;
131
			$output .= '    ' . $command->getDescription() . PHP_EOL;
132
			foreach($arguments as $argument) {
133
				$output .= '    - ' . $argument->getName();
134
				if (!$argument->isRequired()) {
135
					$output .= ' (optional)';
136
				}
137
				$output .= ': ' . $argument->getDescription();
138
				$output .= PHP_EOL;
139
			}
140
			$output .= PHP_EOL;
141
			$lastCommandName = $command->getCommandName();
142
		}
143
		return $output;
144
	}
145

  
146
	/**
147
	 * Parses given string and executes respective commands
148
	 *
149
	 * @return string $input command to be executed in the format "CommandName SubCommandName argument1 argument2"
150
	 * @return void
151
	 * @author Bastian Waidelich <bastian@typo3.org>
152
	 */
153
	public function parseInput($input) {
154
		$trimmedInput = trim($input);
155
		if ($trimmedInput === '') {
156
			throw new \F3\FLOW3\CLI\Exception\InvalidInput('Could not parse empty input.', 1254231716);
157
		}
158
		$words = explode(' ', $trimmedInput);
159
		if (count($words) > 1) {
160
			foreach($this->registeredCommands as $command) {
161
				if ($command->getSignature() === $words[0] . ' ' . $words[1]) {
162
					$command->execute(array_slice($words, 2));
163
					return;
164
				}
165
			}
166
		}
167
		foreach($this->registeredCommands as $command) {
168
			if ($command->getSignature() === $words[0]) {
169
				$command->execute(array_slice($words, 1));
170
				return;
171
			}
172
		}
173
		throw new \F3\FLOW3\CLI\Exception\InvalidInput('Could not parse empty input.', 1254231716);
174
	}
175

  
176
	/**
177
	 * Reads a string from the CLI.
178
	 *
179
	 * @return string the trimmed string entered by the user
180
	 * @api
181
	 * @author Bastian Waidelich <bastian@typo3.org>
182
	 */
183
	public function readLine() {
184
		$stdin = fopen('php://stdin', 'r');
185
		$result = fread($stdin, 1024);
186
		fclose($stdin);
187
		return trim($result);
188
	}
189
}
190

  
191
?>
0 192

  
Packages/Framework/FLOW3/Classes/Reflection/Service.php (working copy)
568 568
	}
569 569

  
570 570
	/**
571
	 * Returns the description of the given method
572
	 *
573
	 * @param string $className Name of the class containing the method
574
	 * @param string $methodName Name of the method to return description of
575
	 * @return string the methods description, without tags
576
	 * @author Bastian Waidelich <bastian@typo3.org>
577
	 * @see F3\FLOW3\Reflection\DocCommentParser::getDescription()
578
	 * @api
579
	 */
580
	public function getMethodDescription($className, $methodName) {
581
		if (!isset($this->reflectedClassNames[$className])) $this->reflectClass($className);
582
		$method = new \ReflectionMethod($className, $methodName);
583
		$docCommentParser = new \F3\FLOW3\Reflection\DocCommentParser();
584
		$docCommentParser->parseDocComment($method->getDocComment());
585
		return $docCommentParser->getDescription();
586
	}
587

  
588
	/**
571 589
	 * Returns an array of parameters of the given method. Each entry contains
572 590
	 * additional information about the parameter position, type hint etc.
573 591
	 *
Packages/Framework/FLOW3/Scripts/FLOW3CLI.php (revision 0)
1
<?php
2
declare(ENCODING = 'utf-8');
3

  
4
/*                                                                        *
5
 * This script belongs to the FLOW3 framework.                            *
6
 *                                                                        *
7
 * It is free software; you can redistribute it and/or modify it under    *
8
 * the terms of the GNU Lesser General Public License as published by the *
9
 * Free Software Foundation, either version 3 of the License, or (at your *
10
 * option) any later version.                                             *
11
 *                                                                        *
12
 * This script is distributed in the hope that it will be useful, but     *
13
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
14
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
15
 * General Public License for more details.                               *
16
 *                                                                        *
17
 * You should have received a copy of the GNU Lesser General Public       *
18
 * License along with the script.                                         *
19
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
20
 *                                                                        *
21
 * The TYPO3 project - inspiring people to share!                         *
22
 *                                                                        */
23

  
24
/**
25
 * FLOW3 CLI
26
 *
27
 * @version $Id$
28
 * @author Bastian Waidelich <bastian@typo3.org>
29
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser Public License, version 3 or later
30
 */
31
require(__DIR__ . '/../Classes/Core/Bootstrap.php');
32
$flow3 = new \F3\FLOW3\Core\Bootstrap(getenv('FLOW3_CONTEXT'));
33
$flow3->initializeClassLoader();
34
$flow3->initializeConfiguration();
35
$flow3->initializeObjectManager();
36
$flow3->initializePackages();
37

  
38
$reflectionService = new \F3\FLOW3\Reflection\Service();
39
$FLOW3Package = new \F3\FLOW3\Package\Package('FLOW3', FLOW3_PATH_FLOW3);
40
$configurationManager = new \F3\FLOW3\Configuration\Manager(getenv('FLOW3_CONTEXT'));
41
$configurationManager->injectConfigurationSource(new \F3\FLOW3\Configuration\Source\YAMLSource());
42
$configurationManager->setPackages(array('FLOW3' => $FLOW3Package));
43
$settings = $configurationManager->getSettings('FLOW3');
44

  
45
$host = new \F3\FLOW3\CLI\Host();
46

  
47
	// register configured actions as command
48
foreach($settings['cli']['commandSets'] as $commandSetName => $commandSetSettings) {
49
	$controllerClassName = $commandSetSettings['controller'];
50
	foreach($commandSetSettings['actions'] as $actionName) {
51
		$actionMethodName = $actionName . 'Action';
52
		$actionMethodDescription = $reflectionService->getMethodDescription($controllerClassName, $actionMethodName);
53
		$actionMethodParameters = $reflectionService->getMethodParameters($controllerClassName, $actionMethodName);
54
		$actionMethodTagsValues = $reflectionService->getMethodTagsValues($controllerClassName, $actionMethodName);
55
		$actionMethodParamAnnotations = array();
56
		if (isset($actionMethodTagsValues['param'])) {
57
			$actionMethodParamAnnotations = $actionMethodTagsValues['param'];
58
		}
59
		$command = new \F3\FLOW3\CLI\Command\Command($commandSetName, $actionName, $actionMethodDescription);
60
		$i = 0;
61
		foreach($actionMethodParameters as $actionMethodParameterName => $actionMethodParameter) {
62
			$actionMethodParameterDescription = '';
63
			if (isset($actionMethodParamAnnotations[$i])) {
64
				$explodedAnnotation = explode(' ', $actionMethodParamAnnotations[$i]);
65
				$actionMethodParameterDescription = implode(' ', array_slice($explodedAnnotation, 2));
66
			}
67
			$commandArgument = new \F3\FLOW3\CLI\Command\CommandArgument($actionMethodParameterName, $actionMethodParameterDescription, !$actionMethodParameter['optional']);
68
			$command->registerArgument($commandArgument);
69
			$i ++;
70
		}
71
		$command->onExecute(function(\F3\FLOW3\CLI\Command\Command $command, array $arguments) use($host, $controllerClassName, $actionMethodName, $actionMethodParameters) {
72
				$argumentString = '';
73
				if (count($arguments) > 0) {
74
					$argumentString = '"' . implode('", "', $arguments) . '"';
75
				}
76
				$host->outputLine('executing');
77
				$host->outputLine($controllerClassName . '::' . $actionMethodName . '(' . $argumentString . ')');
78
				$host->outputLine('execution of actions not yet implemented ;)');
79
				$host->outputLine();
80
			});
81
		$host->registerCommand($command);
82
	}
83
}
84

  
85
	// register "help" command
86
$helpCommand = new \F3\FLOW3\CLI\Command\Command('help', NULL, 'Display this help');
87
$helpCommand->onExecute(function() use ($host) {
88
		$host->outputHelp();
89
	});
90
$host->registerCommand($helpCommand);
91

  
92
	// register "quite" command
93
$quitCommand = new \F3\FLOW3\CLI\Command\Command('quit', NULL, 'Quit CLI mode');
94
$quitCommand->onExecute(function() use ($host) {
95
		$host->outputLine('exiting.');
96
		exit;
... This diff was truncated because it exceeds the maximum size that can be displayed.
(2-2/7)