Moodle

Parsing the command line arguments for script

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.1
  • Fix Version/s: 2.0
  • Component/s: Unknown
  • Labels:
    None
  • Environment:
    PHP
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

PEAR library is used to fetch the command line arguments. Then the PEAR result if further processed using our own functions. Final output is an array containing valid options and valid arguments

Activity

Hide
Dilan Anuruddha Karanachcharighe added a comment -

At the moment I have done the part of fetching the arguments using PEAR Console library and formatting them to appropriate format. PEAR errors are in English only. So we will not print errors returned by PEAR. instead we will use our own error messages which will be in lang/install.php.
Custom functions are at the moment kept in the same script file. But moving them to library file has to be done. At the moment it will be a file like libinstall.php in lib directory.

Show
Dilan Anuruddha Karanachcharighe added a comment - At the moment I have done the part of fetching the arguments using PEAR Console library and formatting them to appropriate format. PEAR errors are in English only. So we will not print errors returned by PEAR. instead we will use our own error messages which will be in lang/install.php. Custom functions are at the moment kept in the same script file. But moving them to library file has to be done. At the moment it will be a file like libinstall.php in lib directory.
Hide
Dilan Anuruddha Karanachcharighe added a comment -

Also these arguments for the script is to be used for non interactive mode. At the moment Penny(correct me if i'm wrong) suggested that we will go with level of interactivity scheme where
Level 0 --mean non interactive
Level 1 --mean interactive for options that are not provided in the arguments to the script
Level 2 – mean total interactive (ignore script arguments provided)

This scheme seems fine. So I'm planning to use this scheme.

Show
Dilan Anuruddha Karanachcharighe added a comment - Also these arguments for the script is to be used for non interactive mode. At the moment Penny(correct me if i'm wrong) suggested that we will go with level of interactivity scheme where Level 0 --mean non interactive Level 1 --mean interactive for options that are not provided in the arguments to the script Level 2 – mean total interactive (ignore script arguments provided) This scheme seems fine. So I'm planning to use this scheme.
Hide
Petr Škoda (skodak) added a comment -

I have committed a bit different code that is using Moodle coding style, I hope it will be sufficient for all tasks
thanks anyway

Show
Petr Škoda (skodak) added a comment - I have committed a bit different code that is using Moodle coding style, I hope it will be sufficient for all tasks thanks anyway

People

Dates

  • Created:
    Updated:
    Resolved: