-
·
WP_CLIUtilsformat_items()
Render a collection of items as an ASCII table, JSON, CSV, YAML, list of ids, or count. Usage WP_CLI\Utils\format_items( $format, $items, $fields ) $format (string) Format to use: ‘table’, ‘json’, ‘csv’, ‘yaml’, ‘ids’, ‘count’. $items (array<mixed>) An array of items to output. $fields (array<string>|string) Named fields for each item of data. Can be array or…
-
·
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…