Skip to content

Commit

Permalink
Change array short syntax in README
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Sep 2, 2023
1 parent d37a0e5 commit 2e72dcc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ its values will be stored in an array.

```php
<?php
$options = array(
$options = [
'a', // short flag -a, parameter is not allowed
'b:', // short flag -b, parameter is required
'c::', // short flag -c, parameter is optional
'foo', // long option --foo, parameter is not allowed
'bar:', // long option --bar, parameter is required
'baz::', // long option --baz, parameter is optional
'g*::', // short flag -g, parameter is optional, multi-pass
);
];

$getopt = $context->getopt($options);
?>
Expand Down Expand Up @@ -139,9 +139,9 @@ The values will be stored under both names;
```php
<?php
// alias -f to --foo
$options = array(
$options = [
'foo,f:', // long option --foo or short flag -f, parameter required
);
];

$getopt = $context->getopt($options);

Expand All @@ -155,10 +155,10 @@ of the option name.

```php
<?php
$options = array(
$options = [
'f*',
'foo*:'
);
];

$getopt = $context->getopt($options);

Expand Down Expand Up @@ -213,10 +213,10 @@ Defined options will be removed from the arguments automatically.

```php
<?php
$options = array(
$options = [
'a',
'foo:',
);
];

$getopt = $context->getopt($options);

Expand Down Expand Up @@ -351,10 +351,10 @@ class MyCommandHelp extends Help
{
$this->setSummary('A single-line summary.');
$this->setUsage('<arg1> [<arg2>]');
$this->setOptions(array(
$this->setOptions([
'f,foo' => "The -f/--foo option description.",
'bar::' => "The --bar option description.",
));
]);
$this->setDescr("A multi-line description of the command.");
}
}
Expand Down Expand Up @@ -419,12 +419,12 @@ $stdio = $cli_factory->newStdio();

$help = new Help(new OptionFactory);
$this->setSummary('A single-line summary.');
$help->setOptions(array(
$help->setOptions([
'f,foo' => "The -f/--foo option description.",
'bar::' => "The --bar option description.",
'#arg1' => "The description for argument 1.",
'#arg2?' => "The description for argument 2.",
));
]);
$this->setDescr("A multi-line description of the command.");

$stdio->outln($help->getHelp('my-command'));
Expand Down

0 comments on commit 2e72dcc

Please sign in to comment.