feature-cli.php
Table of Contents
- ensure_cli() : void
- Ensures that the current execution environment is the command-line interface.
- cli() : void
- Parses $_SERVER["argv"] and provides a command-line interface.
- cli_shell() : mixed
- Starts the Pepperminty Wiki CLI Shell.
- cli_exec() : int
- Executes a given Pepperminty Wiki shell command.
- cli_register() : void
- Registers a new CLI command.
Functions
ensure_cli()
Ensures that the current execution environment is the command-line interface.
ensure_cli() : void
This function will not return if thisthe current execution environment is not the CLI.
Return values
void —cli()
Parses $_SERVER["argv"] and provides a command-line interface.
cli() : void
This function kill the process if the current execution environment is not the CLI.
Return values
void —cli_shell()
Starts the Pepperminty Wiki CLI Shell.
cli_shell() : mixed
This function kill the process if the current execution environment is not the CLI.
Return values
mixed —cli_exec()
Executes a given Pepperminty Wiki shell command.
cli_exec(string|array<string|int, mixed> $string) : int
This function kill the process if the current execution environment is not the CLI. The returned exit code functions as a normal shell process exit code does.
Parameters
- $string : string|array<string|int, mixed>
-
The shell command to execute.
Return values
int —The exit code of the command executed.
cli_register()
Registers a new CLI command.
cli_register(string $name, string $description, callable $function) : void
Throws an error if a CLI command with the specified name already exists.
Parameters
- $name : string
-
The name of command.
- $description : string
-
The description of the command.
- $function : callable
-
The function to execute when this command is executed. An array is passed as the first and only argument containing the arguments passed when the command was invoked.