Jelix 1.6.40

jCmdUtils
in package

utilities functions for command line

Tags
subpackage

utils

static

Table of Contents

getOptionsAndParams()  : array<string|int, mixed>
analyze command line parameters and return an array of all options and parameters which correspond to allowed options and parameters
__construct()  : mixed

Methods

getOptionsAndParams()

analyze command line parameters and return an array of all options and parameters which correspond to allowed options and parameters

public static getOptionsAndParams(array<string|int, mixed> $argv, array<string|int, mixed> $sws, array<string|int, mixed> $params) : array<string|int, mixed>

allowed options should be an array like this : array('-option1'=>bool, '-option2'=>bool, ..) the boolean indicates that the option has a value on the CLI

allowed parameters is an array like this: array('param1'=>bool, 'param2'=>bool, ..) it means that the first parameter value will be in the param1, the second in param2 etc.. The boolean says that the parameter is required (true) or optional (false). If a parameter is optional, following parameters should be optional.

the returned array contains two array : array('-option1'=>value, '-option2'=>value, ...) array('param1'=>value, 'param2'=>value...)

Parameters
$argv : array<string|int, mixed>

the array of parameters given by php-cli

$sws : array<string|int, mixed>

allowed options

$params : array<string|int, mixed>

allowed parameters

Tags
throws
jException
Return values
array<string|int, mixed>

an array with the array of founded option and an array with founded parameters

Search results