Skip to content

Commit 41e37b4

Browse files
committed
Updated README.md
1 parent c4d9f8c commit 41e37b4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ composer require initphp/console
1616
```php
1717
#!usr/bin/php
1818
require_once __DIR__ . '/../vendor/autoload.php';
19-
use InitPHP\Console\Console;
19+
use \InitPHP\Console\{Application, Input, Output};
2020

21-
$console = new Console();
21+
$console = new Application("My Console Application", '1.0');
2222

2323
// Register commands ...
2424

2525
// 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')
3030
]);
31-
}else{
32-
$console->message('Hello World!');
31+
} else {
32+
$output->writeln('Hello World!');
3333
}
3434
}, 'Says hello.');
3535

0 commit comments

Comments
 (0)