PHP Class Moosh\MooshCommand

Afficher le fichier Open project: tmuras/moosh Class Usage Examples

Méthodes publiques

Свойство Type Description
$BOOTSTRAP_CONFIG set CLI_SCRIPT, ABORT_AFTER_CONFIG and include config.php
$BOOTSTRAP_FULL set CLI_SCRIPT and include config.php
$BOOTSTRAP_FULL_NOCLI no CLI_SCRIPT, include config.php
$BOOTSTRAP_NONE Do not include config.php at all
$arguments
$cwd string Current working directory
$defaults array Default global options
$expandedOptions array After expanding
$finalOptions array Before expanding
$mooshDir string moosh installation directory.
$options
$relativeDir string Directory relative to the current Moodle root dir.
$spec GetOptionKit\OptionSpecCollection
$topDir string Top Moodle installation directory.
$verbose

Protected Properties

Свойство Type Description
$argumentNames array
$group
$maxArguments integer .
$minArguments integer How many arguments minimum are required.
$name
$parsedOptions GetOptionKit\OptionResult
$pluginInfo array Possible information on plugin in a current directory.
$session array Temporary session information.

Méthodes publiques

Méthode Description
__construct ( $name, $group = NULL )
addArgument ( string $name, $type = ARG_GENERIC ) Define required argument. Call function again to add another argument.
addOption ( $optionSpec, $description = NULL, $default = NULL )
bootstrapLevel ( ) : integer Should command be bootstrapped as CLI_SCRIPT and include config.php?
checkDirArg ( $name )
checkFileArg ( $name )
checkPathArg ( $name )
expandOptions ( ) Make the special replacements of %s in the options
expandOptionsManually ( $replacements ) Make the special replacements of %s in the options with custom list of arguments
getName ( )
printOptions ( )
processOptions ( $defaults )
requireHomeWriteable ( ) : integer Does the command require writing to ~/.moosh/ directory?
setArguments ( $arguments )
setParsedOptions ( $parsedOptions )
setPluginInfo ( $pluginInfo )
status ( )

Méthodes protégées

Méthode Description
getArgumentsHelp ( ) Can be overwritten by child classes to provide custom description.
getLangCategory ( )
loadSession ( ) Loads temporary session information from the temp file.
onErrorHelp ( ) : string Overwrite to display extra information (e.g. help) when error occured (e.g. wrong arguments were given)
saveSession ( ) Saves session information to the temp file.

Method Details

__construct() public méthode

public __construct ( $name, $group = NULL )

addArgument() public méthode

Define required argument. Call function again to add another argument.
public addArgument ( string $name, $type = ARG_GENERIC )
$name string

addOption() public méthode

public addOption ( $optionSpec, $description = NULL, $default = NULL )

bootstrapLevel() public méthode

Should command be bootstrapped as CLI_SCRIPT and include config.php?
public bootstrapLevel ( ) : integer
Résultat integer

checkDirArg() public méthode

public checkDirArg ( $name )

checkFileArg() public méthode

public checkFileArg ( $name )

checkPathArg() public méthode

public checkPathArg ( $name )

expandOptions() public méthode

Make the special replacements of %s in the options
public expandOptions ( )

expandOptionsManually() public méthode

Make the special replacements of %s in the options with custom list of arguments
public expandOptionsManually ( $replacements )

getArgumentsHelp() protected méthode

Can be overwritten by child classes to provide custom description.
protected getArgumentsHelp ( )

getLangCategory() protected méthode

protected getLangCategory ( )

getName() public méthode

public getName ( )

loadSession() protected méthode

Loads temporary session information from the temp file.
protected loadSession ( )

onErrorHelp() protected méthode

Overwrite to display extra information (e.g. help) when error occured (e.g. wrong arguments were given)
protected onErrorHelp ( ) : string
Résultat string

printOptions() public méthode

public printOptions ( )

processOptions() public méthode

public processOptions ( $defaults )

requireHomeWriteable() public méthode

Does the command require writing to ~/.moosh/ directory?
public requireHomeWriteable ( ) : integer
Résultat integer

saveSession() protected méthode

Saves session information to the temp file.
protected saveSession ( )

setArguments() public méthode

public setArguments ( $arguments )

setParsedOptions() public méthode

public setParsedOptions ( $parsedOptions )

setPluginInfo() public méthode

public setPluginInfo ( $pluginInfo )

status() public méthode

public status ( )

Property Details

$BOOTSTRAP_CONFIG public_oe static_oe property

set CLI_SCRIPT, ABORT_AFTER_CONFIG and include config.php
public static $BOOTSTRAP_CONFIG

$BOOTSTRAP_FULL public_oe static_oe property

set CLI_SCRIPT and include config.php
public static $BOOTSTRAP_FULL

$BOOTSTRAP_FULL_NOCLI public_oe static_oe property

no CLI_SCRIPT, include config.php
public static $BOOTSTRAP_FULL_NOCLI

$BOOTSTRAP_NONE public_oe static_oe property

Do not include config.php at all
public static $BOOTSTRAP_NONE

$argumentNames protected_oe property

protected array $argumentNames
Résultat array

$arguments public_oe property

public $arguments

$cwd public_oe property

Current working directory
public string $cwd
Résultat string

$defaults public_oe property

Default global options
public array $defaults
Résultat array

$expandedOptions public_oe property

After expanding
public array $expandedOptions
Résultat array

$finalOptions public_oe property

Before expanding
public array $finalOptions
Résultat array

$group protected_oe property

protected $group

$maxArguments protected_oe property

.
protected int $maxArguments
Résultat integer

$minArguments protected_oe property

How many arguments minimum are required.
protected int $minArguments
Résultat integer

$mooshDir public_oe property

moosh installation directory.
public string $mooshDir
Résultat string

$name protected_oe property

protected $name

$options public_oe property

public $options

$parsedOptions protected_oe property

protected OptionResult,GetOptionKit $parsedOptions
Résultat GetOptionKit\OptionResult

$pluginInfo protected_oe property

Possible information on plugin in a current directory.
protected array $pluginInfo
Résultat array

$relativeDir public_oe property

Directory relative to the current Moodle root dir.
public string $relativeDir
Résultat string

$session protected_oe property

Temporary session information.
protected array $session
Résultat array

$spec public_oe property

public OptionSpecCollection,GetOptionKit $spec
Résultat GetOptionKit\OptionSpecCollection

$topDir public_oe property

Top Moodle installation directory.
public string $topDir
Résultat string

$verbose public_oe property

public $verbose