File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -16,20 +16,20 @@ composer require initphp/console
16
16
``` php
17
17
#!usr/bin/php
18
18
require_once __DIR__ . '/../vendor/autoload.php';
19
- use InitPHP\Console\Console ;
19
+ use \ InitPHP\Console\{Application, Input, Output} ;
20
20
21
- $console = new Console( );
21
+ $console = new Application("My Console Application", '1.0' );
22
22
23
23
// Register commands ...
24
24
25
25
// hello -name=John
26
- $console->register('hello', function (Console $console ) {
27
- if ($console->has_flag ('name')) {
28
- $console->message(" Hello {name}" , [
29
- 'name' => $console->flag ('name')
26
+ $console->register('hello', function (Input $input, Output $output ) {
27
+ if ($input->hasArgument ('name')) {
28
+ $output->writeln(' Hello {name}' , [
29
+ 'name' => $input->getArgument ('name')
30
30
]);
31
- }else{
32
- $console->message ('Hello World!');
31
+ } else {
32
+ $output->writeln ('Hello World!');
33
33
}
34
34
}, 'Says hello.');
35
35
You can’t perform that action at this time.
0 commit comments