-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getArgumentValues and getFlagValues added
tests added README improved
- Loading branch information
Nathan
committed
Sep 22, 2012
1 parent
6359c9a
commit d2d941a
Showing
4 changed files
with
119 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
// Clearer definition of Arguments vs. Flags | ||
|
||
require dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
||
// v0.2.0 started to add a clearer definition between "flag" type options | ||
// and "argument" type options for those that may prefer it. | ||
// In Commando, flags are options that require a name when they are being | ||
// specified on the command line. Arguments are options that are not named in | ||
// this way. In the example below, '-f' and '--long' are described as "flags" | ||
// type options in Commando terms with the values 'value1' and 'value2' | ||
// respectively, whereas value3, value4, and value5 are described as "argument" | ||
// type options. | ||
// php argumentsVsFlags.php -f value1 --long value2 value3 value4 value5 | ||
|
||
$cmd = new Commando\Command(); | ||
$cmd | ||
->flag('f') | ||
->flag('l') | ||
->aka('long') | ||
->argument() | ||
->argument() | ||
->argument(); | ||
|
||
var_dump($cmd->getArgumentValues()); | ||
var_dump($cmd->getFlagValues()); | ||
|
||
// This is equivalent to... | ||
|
||
// $cmd = new Commando\Command(); | ||
// $cmd | ||
// ->option('f') | ||
// ->option('l') | ||
// ->aka('long') | ||
// ->option() | ||
// ->option() | ||
// ->option(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters