Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
#!/usr/bin/php
2
<?php
3
/**
4
 * This is an example with Console_Getopt::getopt() which you must install
5
 * separately as it does not come with Console_GetoptPlus.
6
 *
7
 * Examples to run on the command line:
8
 * #getoptold --foo -b car -c
9
 * #getoptold --bar car param1 param2
10
 * run the following with the longoptions including "fool"
11
 * #getoptold --foo -b car --fool
12
 */
13
 
14
require_once 'Console/Getopt.php';
15
 
16
$shortOptions = 'b:c::';
17
$longOptions = array('foo', 'bar=');
18
// $longOptions = array('foo=', 'bar=', 'fool=='); // will return the "ambigous" error
19
$args = Console_Getopt::readPHPArgv();
20
$options = Console_Getopt::getopt($args, $shortOptions, $longOptions);
21
PEAR::isError($options) and $options = $options->getMessage();
22
 
23
print_r($options);
24
 
25
?>