[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/system/pear/Console/ -> Getopt.php (sommaire)

(pas de description)

Poids: 251 lignes (10 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Console_Getopt:: (6 méthodes):
  getopt2()
  getopt()
  doGetopt()
  _parseShortOption()
  _parseLongOption()
  readPHPArgv()


Classe: Console_Getopt  - X-Ref

Command-line options parsing class.

getopt2($args, $short_options, $long_options = null)   X-Ref
Parses the command-line options.

The first parameter to this function should be the list of command-line
arguments without the leading reference to the running program.

The second parameter is a string of allowed short options. Each of the
option letters can be followed by a colon ':' to specify that the option
requires an argument, or a double colon '::' to specify that the option
takes an optional argument.

The third argument is an optional array of allowed long options. The
leading '--' should not be included in the option name. Options that
require an argument should be followed by '=', and options that take an
option argument should be followed by '=='.

The return value is an array of two elements: the list of parsed
options and the list of non-option command-line arguments. Each entry in
the list of parsed options is a pair of elements - the first one
specifies the option, and the second one specifies the option argument,
if there was one.

Long and short options can be mixed.

Most of the semantics of this function are based on GNU getopt_long().

param: array  $args           an array of command-line arguments
param: string $short_options  specifies the list of allowed short options
param: array  $long_options   specifies the list of allowed long options
return: array two-element array containing the list of parsed options and

getopt($args, $short_options, $long_options = null)   X-Ref
This function expects $args to start with the script name (POSIX-style).
Preserved for backwards compatibility.


doGetopt($version, $args, $short_options, $long_options = null)   X-Ref
The actual implementation of the argument parsing code.


_parseShortOption($arg, $short_options, &$opts, &$args)   X-Ref


_parseLongOption($arg, $long_options, &$opts, &$args)   X-Ref


readPHPArgv()   X-Ref
Safely read the $argv PHP array across different PHP configurations.
Will take care on register_globals and register_argc_argv ini directives

return: mixed the $argv PHP array or PEAR error if not registered



Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics