[ Index ]

PHP Cross Reference of Unnamed Project

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: 229 lines (7 kb)
Included or required: 6 times
Referenced: 0 times
Includes or requires: 0 files

Defines 9 functions

  cli_write()
  cli_writeln()
  cli_input()
  cli_get_params()
  cli_separator()
  cli_heading()
  cli_problem()
  cli_error()
  cli_logo()

Functions
Functions that are not part of a class:

cli_write($text, $stream=STDOUT)   X-Ref
Write a text to the given stream

param: string $text text to be written
param: resource $stream output stream to be written to, defaults to STDOUT

cli_writeln($text, $stream=STDOUT)   X-Ref
Write a text followed by an end of line symbol to the given stream

param: string $text text to be written
param: resource $stream output stream to be written to, defaults to STDOUT

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 error output and exit with the given code

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

cli_logo($padding=2, $return=false)   X-Ref
Print an ASCII version of the Moodle logo.

param: int $padding left padding of the logo
param: bool $return should we print directly (false) or return the string (true)
return: mixed void or string



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1