Created
January 3, 2011 20:56
-
-
Save tylerhall/763952 to your computer and use it in GitHub Desktop.
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
cmd -a -b -c // Single letter flags | |
cmd -abc // Same as above |
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
cmd -a foobar.jpg -bc |
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
cmd --some-flag | |
cmd --another-flag=charlie // You can use an equal sign | |
cmd --another-flag charlie // Or not. It's up to you. |
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
cmd -ab --bigflag=foo -c bar apricot orange |
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
<?PHP | |
$args = new Args(); | |
if($args->flag('a')) | |
// -a was set, so do something | |
if($args->flag('bigflag') == 'foo') | |
// --bigflag was set to 'foo' | |
foreach($args->args as $arg) | |
// Do something with each argument. | |
// Args will be bar, apricot, and orange. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment