GLib.OptionContext.prototype.parse
function parse(argv: Array(String)): [ok: Boolean, argv: Array(String)] { // Gjs wrapper for g_option_context_parse() }
Parses the command line arguments, recognizing options which have been added to context. A side-effect of calling this function is that GLib.set_prgname will be called.
If the parsing is successful, any parsed arguments are removed from the array and argc and argv are updated accordingly. A '--' option is stripped from argv unless there are unparsed options before and after it, or some of the options after it start with '-'. In case of an error, argc and argv are left unmodified.
If automatic `--help` support is enabled (see GLib.OptionContext.prototype.set_help_enabled), and the argv array contains one of the recognized help options, this function will produce help output to stdout and call `exit (0)`.
Note that function depends on the [current locale][setlocale] for automatic character set conversion of string and filename arguments.
Since 2.6
- argv
a pointer to the array of command line arguments
- ok
true if the parsing was successful, false if an error occurred
- argv (out)
a pointer to the array of command line arguments