Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Utils\ScriptUtils Class Reference

Static Public Member Functions

static traceUsageHelp ()
 Returns a help message for the tracing flags.
 
static dumpUsageHelp ()
 Returns a help message for the dump flags.
 
static debugUsageHelp ()
 Returns a help message for the debug flags.
 
static setDebuggingFlags (array &$envOptions, array $cliOpts)
 Set debugging flags on an object, based on an options object.
 
static setTemplatingAndProcessingFlags (array &$envOptions, array $cliOpts)
 Sets templating and processing flags on an object, based on an options object.
 
static booleanOption ( $val)
 Parse a boolean option returned by our opts processor.
 
static setColorFlags (array $options)
 Set the color flags, based on an options object.
 
static addStandardOptions (array $opts, array $defaults=[])
 PORT-FIXME: Should some of this functionality be moved to OptsProcessor directly?
 

Member Function Documentation

◆ addStandardOptions()

static Wikimedia\Parsoid\Utils\ScriptUtils::addStandardOptions ( array $opts,
array $defaults = [] )
static

PORT-FIXME: Should some of this functionality be moved to OptsProcessor directly?

Add standard options to script-specific opts This handles options parsed by setDebuggingFlags, setTemplatingAndProcessingFlags, setColorFlags, and standard –help options.

The defaults option is optional, and lets you override the defaults for the standard options.

Parameters
array$opts
array$defaults
Returns
array

◆ booleanOption()

static Wikimedia\Parsoid\Utils\ScriptUtils::booleanOption ( $val)
static

Parse a boolean option returned by our opts processor.

The strings 'false' and 'no' are also treated as false values. This allows --debug=no and --debug=false to mean the same as --no-debug.

Parameters
bool | string$vala boolean, or a string naming a boolean value.
Returns
bool

◆ debugUsageHelp()

static Wikimedia\Parsoid\Utils\ScriptUtils::debugUsageHelp ( )
static

Returns a help message for the debug flags.

Returns
string

◆ dumpUsageHelp()

static Wikimedia\Parsoid\Utils\ScriptUtils::dumpUsageHelp ( )
static

Returns a help message for the dump flags.

Returns
string

◆ setColorFlags()

static Wikimedia\Parsoid\Utils\ScriptUtils::setColorFlags ( array $options)
static

Set the color flags, based on an options object.

Parameters
array$optionsoptions object to use for setting the mode of the 'color' package.
  • string|boolean options.color Whether to use color. Passing 'auto' will enable color only if stdout is a TTY device. @suppress PhanEmptyPublicMethod

PORT-FIXME: if ( $options->color === 'auto' ) { if ( !$process->stdout->isTTY ) { $colors->mode = 'none'; } } elseif ( !self::booleanOption( $options->color ) ) { $colors->mode = 'none'; }

◆ setDebuggingFlags()

static Wikimedia\Parsoid\Utils\ScriptUtils::setDebuggingFlags ( array & $envOptions,
array $cliOpts )
static

Set debugging flags on an object, based on an options object.

Parameters
array&$envOptionsOptions to be passed to the Env constructor.
array$cliOptsThe options object to use for setting the debug flags.
Returns
array The modified object.

◆ setTemplatingAndProcessingFlags()

static Wikimedia\Parsoid\Utils\ScriptUtils::setTemplatingAndProcessingFlags ( array & $envOptions,
array $cliOpts )
static

Sets templating and processing flags on an object, based on an options object.

Parameters
array&$envOptionsOptions to be passed to the Env constructor.
array$cliOptsThe options object to use for setting the debug flags.
Returns
array The modified object.

◆ traceUsageHelp()

static Wikimedia\Parsoid\Utils\ScriptUtils::traceUsageHelp ( )
static

Returns a help message for the tracing flags.

Returns
string

The documentation for this class was generated from the following file: