You appear to be a bot. Output may be restricted
Description
Obtain a value for a command line parameterIf the required parameter key is numeric then we take the positional parameter else we take value of an NVP pair.
This is a simple hack that's not as advanced as WP-CLI, which allows --no-
prefixes to set parameters to false Here we're really only interested in getting url=
Usage
$string = oik_batch_query_value_from_argv( $key, $default );
Parameters
- $key
- ( string ) optional default: url – Not expected to be prefixed with —
- $default
- ( string ) optional default: localhost – Default value if not found
Returns
string value of the parameterSource
File name: oik-batch/libs/oik-cli.phpLines:
1 to 12 of 12
function oik_batch_query_value_from_argv( $key="url", $default="localhost" ) { $argv = $_SERVER['argv']; $value = $default; if ( $_SERVER['argc'] ) { if ( is_numeric( $key ) ) { $value = oik_batch_query_positional_value_from_argv( $_SERVER['argv'], $key, $default ); } else { $value = oik_batch_query_nvp_value_from_argv( $_SERVER['argv'], $key, $default ); } } return( $value ); }View on GitHub