Create CLI Framework/Libraries
Bug #844607 reported by
Andrew Nicols
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Wishlist
|
Andrew Nicols |
Bug Description
I've been having a look at bug #844604. Rather than re-inventing the wheel every time we want to do a CLI system, I propose that we create a CLI library
lib/cli.php
This should ideally give functionality for:
* retrieve arguments supplied on the CLI (e.g. --agree-
* add a log_exit or equivelant which would exit with the appropriate exit code (0 = success, 127 = error, other supplied ints in range) and exit - e.g. cli_exit().
Changed in mahara: | |
status: | In Progress → Fix Committed |
To post a comment you must log in.
I've been pondering whether the log_exit should go with the other error functions (e.g. log_debug) in lib/errors.php.
We currently have no log_die, and I doubt we want one except for CLI stuff (correct me if I'm wrong). Setting the exit code is very CLI specific. Therefore I've been toying with a function
function cli_exit($message, $error = false)