-
·
WP_CLIUtilsget_flag_value()
Return the flag value or, if it’s not set, the $default value. Usage WP_CLI\Utils\get_flag_value( $assoc_args, $flag, $default = null ) $assoc_args (array<string|int,string|bool>) Arguments array. $flag (string|int) Flag to get the value. $default (string|bool|int|null) Default value for the flag. Default: NULL. @return (string|bool|int|null) Notes Because flags can be negated (e.g. –no-quiet to negate –quiet), this function…
-
·
WP_CLIUtilsget_home_dir()
Get the home directory. Usage WP_CLI\Utils\get_home_dir() @return (string) Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related WP_CLI\Utils\trailingslashit() – Appends a trailing slash. WP_CLI\Utils\normalize_path() – Normalize a filesystem path. WP_CLI\Utils\get_temp_dir() – Get the system’s temp directory. Warns user if it isn’t writable. WP_CLI\Utils\get_php_binary()…
-
·
WP_CLIUtilsget_named_sem_ver()
Compare two version strings to get the named semantic version. Usage WP_CLI\Utils\get_named_sem_ver( $new_version, $original_version ) $new_version (string) $original_version (string) @return (string) ‘minor’, ‘patch’ Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related WP_CLI\Utils\write_csv() – Write data as CSV to a given file. WP_CLI\Utils\http_request()…
-
·
WP_CLIUtilsget_php_binary()
Get the path to the PHP binary used when executing WP-CLI. Usage WP_CLI\Utils\get_php_binary() @return (string) Notes Environment values permit specific binaries to be indicated. Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related WP_CLI\Utils\get_home_dir() – Get the home directory. WP_CLI\Utils\trailingslashit() – Appends a…
-
·
WP_CLIUtilslaunch_editor_for_input()
Launch system’s $EDITOR for the user to edit some text. Usage WP_CLI\Utils\launch_editor_for_input( $input, $title = WP-CLI, $ext = tmp ) $input (string) Some form of text to edit (e.g. post content). $title (string) Title to display in the editor. $ext (string) Extension to use with the temp file. @return (string|bool) text, if file is saved…
-
·
WP_CLIUtilsmake_progress_bar()
Create a progress bar to display percent completion of a given operation. Usage WP_CLI\Utils\make_progress_bar( $message, $count, $interval = 100 ) $message (string) Text to display before the progress bar. $count (integer) Total number of ticks to be performed. $interval (int) Optional. The interval in milliseconds between updates. Default 100. @return (\cli\progress\Bar|\WP_CLI\NoOp) Notes Progress bar is…
-
·
WP_CLIUtilsnormalize_path()
Normalize a filesystem path. Usage WP_CLI\Utils\normalize_path( $path ) $path (string) Path to normalize. @return (string) path. Notes On Windows systems, replaces backslashes with forward slashes and forces upper-case drive letters. Allows for two leading slashes for Windows network shares, but ensures that all other duplicate slashes are reduced to a single one. Ensures upper-case drive…
-
·
WP_CLIUtilsparse_ssh_url()
Parse a SSH url for its host, port, and path. Usage WP_CLI\Utils\parse_ssh_url( $url, $component = -1 ) $url (string) $component (int) @return (mixed) Notes Similar to parse_url(), but adds support for defined SSH aliases. host OR host/path/to/wordpress OR host:port/path/to/wordpress Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please…
-
·
WP_CLIUtilsparse_str_to_argv()
Parse a string of command line arguments into an $argv-esqe variable. Usage WP_CLI\Utils\parse_str_to_argv( $arguments ) $arguments (string) @return (array<string>) Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related WP_CLI\Utils\launch_editor_for_input() – Launch system’s $EDITOR for the user to edit some text. WP_CLI\Utils\get_flag_value() – Return…
-
·
WP_CLIUtilsproc_open_compat()
Windows compatible proc_open(). Works around bug in PHP, and also deals with *nix-like ENV_VAR=blah cmd environment variable prefixes. Usage WP_CLI\Utils\proc_open_compat( $cmd, $descriptorspec, $pipes, $cwd = null, $env = null, $other_options = null ) $cmd (string) Command to execute. list<string>|resource> (array<int,) $descriptorspec Indexed array of descriptor numbers and their values. resource> (array<int,) &$pipes Indexed array of…