Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 52... Línea 52...
52
 * @param string $default default value when enter pressed
52
 * @param string $default default value when enter pressed
53
 * @param array $options list of allowed options, empty means any text
53
 * @param array $options list of allowed options, empty means any text
54
 * @param bool $casesensitive true if options are case sensitive
54
 * @param bool $casesensitive true if options are case sensitive
55
 * @return string entered text
55
 * @return string entered text
56
 */
56
 */
57
function cli_input($prompt, $default='', array $options=null, $casesensitiveoptions=false) {
57
function cli_input($prompt, $default='', ?array $options=null, $casesensitiveoptions=false) {
58
    cli_writeln($prompt);
58
    cli_writeln($prompt);
59
    cli_write(': ');
59
    cli_write(': ');
60
    $input = fread(STDIN, 2048);
60
    $input = fread(STDIN, 2048);
61
    $input = trim($input);
61
    $input = trim($input);
62
    if ($input === '') {
62
    if ($input === '') {
Línea 78... Línea 78...
78
 * Returns cli script parameters.
78
 * Returns cli script parameters.
79
 * @param array $longoptions array of --style options ex:('verbose'=>false)
79
 * @param array $longoptions array of --style options ex:('verbose'=>false)
80
 * @param array $shortmapping array describing mapping of short to long style options ex:('h'=>'help', 'v'=>'verbose')
80
 * @param array $shortmapping array describing mapping of short to long style options ex:('h'=>'help', 'v'=>'verbose')
81
 * @return array array of arrays, options, unrecognised as optionlongname=>value
81
 * @return array array of arrays, options, unrecognised as optionlongname=>value
82
 */
82
 */
83
function cli_get_params(array $longoptions, array $shortmapping=null) {
83
function cli_get_params(array $longoptions, ?array $shortmapping=null) {
84
    $shortmapping = (array)$shortmapping;
84
    $shortmapping = (array)$shortmapping;
85
    $options      = array();
85
    $options      = array();
86
    $unrecognized = array();
86
    $unrecognized = array();
Línea 87... Línea 87...
87
 
87