[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/ -> clilib.php (summary)

Command line utility functions and classes

Copyright: 2009 Petr Skoda (http://skodak.org)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 177 lines (5 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 0 files

Defines 6 functions

  cli_input()
  cli_get_params()
  cli_separator()
  cli_heading()
  cli_problem()
  cli_error()

Functions
Functions that are not part of a class:

cli_input($prompt, $default='', array $options=null, $casesensitiveoptions=false)   X-Ref
Get input from user

param: string $prompt text prompt, should include possible options
param: string $default default value when enter pressed
param: array $options list of allowed options, empty means any text
param: bool $casesensitive true if options are case sensitive
return: string entered text

cli_get_params(array $longoptions, array $shortmapping=null)   X-Ref
Returns cli script parameters.

param: array $longoptions array of --style options ex:('verbose'=>false)
param: array $shortmapping array describing mapping of short to long style options ex:('h'=>'help', 'v'=>'verbose')
return: array array of arrays, options, unrecognised as optionlongname=>value

cli_separator($return=false)   X-Ref
Print or return section separator string

param: bool $return false means print, true return as string
return: mixed void or string

cli_heading($string, $return=false)   X-Ref
Print or return section heading string

param: string $string text
param: bool $return false means print, true return as string
return: mixed void or string

cli_problem($text)   X-Ref
Write error notification

param: $text
return: void

cli_error($text, $errorcode=1)   X-Ref
Write to standard out and error with exit in error.

param: string $text
param: int $errorcode
return: void (does not return)



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1