diff --git a/behat-steps.md b/behat-steps.md deleted file mode 100644 index 3228ed87..00000000 --- a/behat-steps.md +++ /dev/null @@ -1,172 +0,0 @@ -# Behat Steps - -WP-CLI makes use of a Behat-based testing framework and provides a set of custom step definitions to write feature tests. - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - -*** -## Given - - - - -## When - - - - -## Then - - - - diff --git a/behat-steps/given-a-custom-wp-content-directory.md b/behat-steps/given-a-custom-wp-content-directory.md deleted file mode 100644 index 7c2ddaec..00000000 --- a/behat-steps/given-a-custom-wp-content-directory.md +++ /dev/null @@ -1,105 +0,0 @@ -# Given a custom wp-content directory - -Configure a custom `wp-content` directory. - - -*** - -## Usage - -Defines the `WP_CONTENT_DIR`, `WP_PLUGIN_DIR`, and `WPMU_PLUGIN_DIR` constants. - -``` -Scenario: My example scenario - Given a WP install - And a custom wp-content directory -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-database.md b/behat-steps/given-a-database.md deleted file mode 100644 index 9929c135..00000000 --- a/behat-steps/given-a-database.md +++ /dev/null @@ -1,105 +0,0 @@ -# Given a database - -Creates an empty database. - - -*** - -## Usage - -Has no effect when tests run with SQLite. - -``` -Scenario: My example scenario - Given a database - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-dependency-on-current-wp-cli.md b/behat-steps/given-a-dependency-on-current-wp-cli.md deleted file mode 100644 index 7fe9ed7d..00000000 --- a/behat-steps/given-a-dependency-on-current-wp-cli.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given a dependency on current wp-cli - -Add `wp-cli/wp-cli` as a Composer dependency. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation with Composer - And a dependency on current wp-cli -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-downloaded-phar-with-the-same-version-version.md b/behat-steps/given-a-downloaded-phar-with-the-same-version-version.md deleted file mode 100644 index b17ca1ed..00000000 --- a/behat-steps/given-a-downloaded-phar-with-the-same-version-version.md +++ /dev/null @@ -1,107 +0,0 @@ -# Given /^a downloaded Phar with (?:the same version|version "([^"]+)")$/ - -Download a specific WP-CLI Phar version from GitHub. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given an empty directory - And a downloaded Phar with version "2.11.0" - -Scenario: My other scenario - Given an empty directory - And a downloaded Phar with the same version -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-misconfigured-wp-content-dir-constant-directory.md b/behat-steps/given-a-misconfigured-wp-content-dir-constant-directory.md deleted file mode 100644 index 52a20f66..00000000 --- a/behat-steps/given-a-misconfigured-wp-content-dir-constant-directory.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given a misconfigured WP_CONTENT_DIR constant directory - -Modify wp-config.php to set `WP_CONTENT_DIR` to an empty string. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP install - And a misconfigured WP_CONTENT_DIR constant directory - ``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-new-phar-with-the-same-version-version.md b/behat-steps/given-a-new-phar-with-the-same-version-version.md deleted file mode 100644 index 5ba5a35f..00000000 --- a/behat-steps/given-a-new-phar-with-the-same-version-version.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given /^a new Phar with (?:the same version|version "([^"]+)")$/ - -Build a new WP-CLI Phar file with a given version. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given an empty directory - And a new Phar with version "2.11.0" -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-php-built-in-web-server-to-serve-subdir.md b/behat-steps/given-a-php-built-in-web-server-to-serve-subdir.md deleted file mode 100644 index 7af2bfb0..00000000 --- a/behat-steps/given-a-php-built-in-web-server-to-serve-subdir.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given a PHP built-in web server to serve :subdir - -Start a PHP built-in web server in the given subdirectory. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation - And a PHP built-in web server to serve 'WordPress' -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-php-built-in-web-server.md b/behat-steps/given-a-php-built-in-web-server.md deleted file mode 100644 index a721b7f2..00000000 --- a/behat-steps/given-a-php-built-in-web-server.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given a PHP built-in web server - -Start a PHP built-in web server in the current directory. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation - And a PHP built-in web server -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-wp-installation-in.md b/behat-steps/given-a-wp-installation-in.md deleted file mode 100644 index c329bfa5..00000000 --- a/behat-steps/given-a-wp-installation-in.md +++ /dev/null @@ -1,111 +0,0 @@ -# Given /^a WP( [^\s]+)? install(?:ation)? in ['"]?([^'"]+)['"]?$/ - -Installs WordPress in a given directory. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation in 'foo' - ... - -Scenario: My other scenario - Given a WP install in 'bar' - ... - -Scenario: My version-specific scenario - Given a WP 6.4.2 installation in 'subdir' - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-wp-installation-with-composer-and-a-custom-vendor-directory-vendor-directory.md b/behat-steps/given-a-wp-installation-with-composer-and-a-custom-vendor-directory-vendor-directory.md deleted file mode 100644 index 44a1aa39..00000000 --- a/behat-steps/given-a-wp-installation-with-composer-and-a-custom-vendor-directory-vendor-directory.md +++ /dev/null @@ -1,107 +0,0 @@ -# Given a WP install(ation) with Composer and a custom vendor directory :vendor_directory - -Installs WordPress with Composer and a custom vendor directory. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation with Composer and a custom vendor directory 'vendor-custom' - ... - -Scenario: My other scenario - Given a WP install with Composer with Composer and a custom vendor directory 'vendor-custom' - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-wp-installation-with-composer.md b/behat-steps/given-a-wp-installation-with-composer.md deleted file mode 100644 index 135b4b94..00000000 --- a/behat-steps/given-a-wp-installation-with-composer.md +++ /dev/null @@ -1,107 +0,0 @@ -# Given a WP install(ation) with Composer - -Installs WordPress with Composer. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation with Composer - ... - -Scenario: My other scenario - Given a WP install with Composer - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-wp-installation.md b/behat-steps/given-a-wp-installation.md deleted file mode 100644 index 475cb45b..00000000 --- a/behat-steps/given-a-wp-installation.md +++ /dev/null @@ -1,111 +0,0 @@ -# Given /^a WP( \d[^\s]+)? install(?:ation)?$/ - -Installs WordPress. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation - ... - -Scenario: My other scenario - Given a WP install - ... - -Scenario: My version-specific scenario - Given a WP 6.4.2 installation - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-a-wp-multisite-subdirectory-subdomaininstall-installation.md b/behat-steps/given-a-wp-multisite-subdirectory-subdomaininstall-installation.md deleted file mode 100644 index 8f93a1e8..00000000 --- a/behat-steps/given-a-wp-multisite-subdirectory-subdomaininstall-installation.md +++ /dev/null @@ -1,109 +0,0 @@ -# Given /^a WP multisite (subdirectory|subdomain)?\s?(install|installation)$/ - -Installs WordPress Multisite. - - -*** - -## Usage - -Supports either subdirectory or subdomain installation. - -``` -Scenario: My example scenario - Given a WP multisite subdomain installation - ... - -Scenario: My other scenario - Given a WP subdirectory install - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-an-empty-cache.md b/behat-steps/given-an-empty-cache.md deleted file mode 100644 index b8d7d67f..00000000 --- a/behat-steps/given-an-empty-cache.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given an empty cache - -Clears the WP-CLI cache directory. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given an empty cache - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-an-empty-directory.md b/behat-steps/given-an-empty-directory.md deleted file mode 100644 index 07e18692..00000000 --- a/behat-steps/given-an-empty-directory.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given an empty directory - -Creates an empty directory. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given an empty directory - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-an-empty-non-existent-directory.md b/behat-steps/given-an-empty-non-existent-directory.md deleted file mode 100644 index 1f1a5328..00000000 --- a/behat-steps/given-an-empty-non-existent-directory.md +++ /dev/null @@ -1,104 +0,0 @@ -# Given /^an? (empty|non-existent) ([^\s]+) directory$/ - -Creates or deletes a specific directory. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given an empty foo-plugin directory - And a non-existent bar-plugin directory - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-an-file-cache-file.md b/behat-steps/given-an-file-cache-file.md deleted file mode 100644 index 006cf6cf..00000000 --- a/behat-steps/given-an-file-cache-file.md +++ /dev/null @@ -1,110 +0,0 @@ -# Given /^an? ([^\s]+) (file|cache file):$/ - -Creates a file with the given contents. - - -*** - -## Usage - -The file can be created either in the current working directory -or in the cache directory. - -``` -Scenario: My example scenario - Given a wp-cli.yml file: - """ - @foo: - path: foo - user: admin - """ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-download.md b/behat-steps/given-download.md deleted file mode 100644 index 62dc77af..00000000 --- a/behat-steps/given-download.md +++ /dev/null @@ -1,105 +0,0 @@ -# Given download: - -Download multiple files into the given destinations. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given download: - | path | url | - | {CACHE_DIR}/foo.jpg | https://example.com/foo.jpg | - | {CACHE_DIR}/bar.png | https://example.com/another-image.png | -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-replaced-with-in-the-file.md b/behat-steps/given-replaced-with-in-the-file.md deleted file mode 100644 index 7bd1f6db..00000000 --- a/behat-steps/given-replaced-with-in-the-file.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given /^"([^"]+)" replaced with "([^"]+)" in the ([^\s]+) file$/ - -Search and replace a string in a file using regex. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given "Foo" replaced with "Bar" in the readme.html file - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-save-stdout-stderr-as.md b/behat-steps/given-save-stdout-stderr-as.md deleted file mode 100644 index bb6740f1..00000000 --- a/behat-steps/given-save-stdout-stderr-as.md +++ /dev/null @@ -1,107 +0,0 @@ -# Given /^save (STDOUT|STDERR) ([\'].+[^\'])?\s?as \{(\w+)\}$/ - -Store STDOUT or STDERR contents in a variable. - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp package path` - Then save STDOUT as {PACKAGE_PATH} - -Scenario: My other scenario - When I run `wp core download` - Then save STDOUT 'Downloading WordPress ([\d\.]+)' as {VERSION} -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-save-the-file-as.md b/behat-steps/given-save-the-file-as.md deleted file mode 100644 index f92b8393..00000000 --- a/behat-steps/given-save-the-file-as.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given /^save the (.+) file ([\'].+[^\'])?as \{(\w+)\}$/ - -Stores the contents of the given file in a variable. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation with Composer - And save the {RUN_DIR}/composer.json file as {COMPOSER_JSON} -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-that-http-requests-to-will-respond-with.md b/behat-steps/given-that-http-requests-to-will-respond-with.md deleted file mode 100644 index 326264cb..00000000 --- a/behat-steps/given-that-http-requests-to-will-respond-with.md +++ /dev/null @@ -1,108 +0,0 @@ -# Given /^that HTTP requests to (.*?) will respond with:$/ - -Mock HTTP requests to a given URL. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given that HTTP requests to https://api.github.com/repos/wp-cli/wp-cli/releases?per_page=100 will respond with: - """ - HTTP/1.1 200 - Content-Type: application/json - - { "foo": "bar" } - """ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-these-installed-and-active-plugins.md b/behat-steps/given-these-installed-and-active-plugins.md deleted file mode 100644 index a548fca1..00000000 --- a/behat-steps/given-these-installed-and-active-plugins.md +++ /dev/null @@ -1,107 +0,0 @@ -# Given these installed and active plugins: - -Installs and activates one or more plugins. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation - And these installed and active plugins: - """ - akismet - wordpress-importer - """ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-wp-config-php.md b/behat-steps/given-wp-config-php.md deleted file mode 100644 index 6275a18e..00000000 --- a/behat-steps/given-wp-config-php.md +++ /dev/null @@ -1,104 +0,0 @@ -# Given wp-config.php - -Create a wp-config.php file using `wp config create`. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given an empty directory - And WP files - And wp-config.php -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/given-wp-files.md b/behat-steps/given-wp-files.md deleted file mode 100644 index ebbacef0..00000000 --- a/behat-steps/given-wp-files.md +++ /dev/null @@ -1,103 +0,0 @@ -# Given WP files - -Download WordPress files without installing. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given an empty directory - And WP files -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-an-email-should-be-sent-not-be-sent.md b/behat-steps/then-an-email-should-be-sent-not-be-sent.md deleted file mode 100644 index f2b85105..00000000 --- a/behat-steps/then-an-email-should-be-sent-not-be-sent.md +++ /dev/null @@ -1,82 +0,0 @@ -# Then /^an email should (be sent|not be sent)$/ - -Expect an email to be sent (or not). - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp user reset-password 1` - Then an email should be sent -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-should-be-a-json-array-containing.md b/behat-steps/then-stdout-should-be-a-json-array-containing.md deleted file mode 100644 index fdfaaf0d..00000000 --- a/behat-steps/then-stdout-should-be-a-json-array-containing.md +++ /dev/null @@ -1,87 +0,0 @@ -# Then /^STDOUT should be a JSON array containing:$/ - -Expect valid JSON array output in STDOUT. - - -*** - -## Usage - -Errors when some items are missing from the expected array. - -``` -Scenario: My example scenario - When I run `wp plugin list --field=name --format=json` - Then STDOUT should be a JSON array containing: - """ - ["akismet", "hello-dolly"] - """ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-should-be-a-table-containing-rows.md b/behat-steps/then-stdout-should-be-a-table-containing-rows.md deleted file mode 100644 index 7eb427f2..00000000 --- a/behat-steps/then-stdout-should-be-a-table-containing-rows.md +++ /dev/null @@ -1,86 +0,0 @@ -# Then /^STDOUT should be a table containing rows:$/ - -Expect STDOUT to be a table containing the given rows. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation - When I run `wp config list --fields=name,type` - Then STDOUT should be a table containing rows: - | name | type | - | DB_NAME | constant | - | DB_USER | constant | -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-should-be-csv-containing.md b/behat-steps/then-stdout-should-be-csv-containing.md deleted file mode 100644 index bbc1a4b9..00000000 --- a/behat-steps/then-stdout-should-be-csv-containing.md +++ /dev/null @@ -1,84 +0,0 @@ -# Then /^STDOUT should be CSV containing:$/ - -Expect STDOUT to be CSV containing certain values. - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp term list post_tag --fields=name,slug --format=csv` - Then STDOUT should be CSV containing: - | name | slug | - | Test term | test | -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-should-be-json-containing.md b/behat-steps/then-stdout-should-be-json-containing.md deleted file mode 100644 index 793ffe0b..00000000 --- a/behat-steps/then-stdout-should-be-json-containing.md +++ /dev/null @@ -1,87 +0,0 @@ -# Then /^STDOUT should be JSON containing:$/ - -Expect valid JSON output in STDOUT. - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp post meta get 1 meta-key --format=json` - Then STDOUT should be JSON containing: - """ - { - "foo": "baz" - } - """ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-should-be-yaml-containing.md b/behat-steps/then-stdout-should-be-yaml-containing.md deleted file mode 100644 index 5a2fd49c..00000000 --- a/behat-steps/then-stdout-should-be-yaml-containing.md +++ /dev/null @@ -1,87 +0,0 @@ -# Then /^STDOUT should be YAML containing:$/ - -Expect STDOUT to be YAML containing certain content. - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp cli alias list` - Then STDOUT should be YAML containing: - """ - @all: Run command against every registered alias. - @foo: - path: {TEST_DIR}/foo - """ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-should-end-with-a-table-containing-rows.md b/behat-steps/then-stdout-should-end-with-a-table-containing-rows.md deleted file mode 100644 index de716025..00000000 --- a/behat-steps/then-stdout-should-end-with-a-table-containing-rows.md +++ /dev/null @@ -1,93 +0,0 @@ -# Then /^STDOUT should end with a table containing rows:$/ - -Expect STDOUT to end with a table containing the given rows. - - -*** - -## Usage - -Useful when the table is preceded by some other output. - -``` -Scenario: My example scenario - Given a WP installation - When I run `wp search-replace foo bar --report-changed-only` - Then STDOUT should contain: - """ - Success: Made 3 replacements. - """ - And STDOUT should end with a table containing rows: - | Table | Column | Replacements | Type | - | wp_options | option_value | 1 | PHP | - | wp_postmeta | meta_value | 1 | SQL | - | wp_posts | post_title | 1 | SQL | -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-stderr-should-be-a-number.md b/behat-steps/then-stdout-stderr-should-be-a-number.md deleted file mode 100644 index b091d88c..00000000 --- a/behat-steps/then-stdout-stderr-should-be-a-number.md +++ /dev/null @@ -1,83 +0,0 @@ -# Then /^(STDOUT|STDERR) should be a number$/ - -Expect STDOUT or STDERR to be a numeric value. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation - When I run `wp db size --size_format=b` - Then STDOUT should be a number -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-stderr-should-be-a-version-string-w.md b/behat-steps/then-stdout-stderr-should-be-a-version-string-w.md deleted file mode 100644 index bc4236dc..00000000 --- a/behat-steps/then-stdout-stderr-should-be-a-version-string-w.md +++ /dev/null @@ -1,83 +0,0 @@ -# Then /^(STDOUT|STDERR) should be a version string (<|<=|>|>=|==|=|!=|<>) ([+\w.{}-]+)$/ - -Expect STDOUT or STDERR to be a version string comparing to the given version. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP install - When I run `wp core version - Then STDOUT should be a version string >= 6.8 -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-stderr-should-be-empty.md b/behat-steps/then-stdout-stderr-should-be-empty.md deleted file mode 100644 index 01b9b57f..00000000 --- a/behat-steps/then-stdout-stderr-should-be-empty.md +++ /dev/null @@ -1,83 +0,0 @@ -# Then /^(STDOUT|STDERR) should be empty$/ - -Expect STDOUT or STDERR to be empty. - - -*** - -## Usage - -``` -Scenario: My other scenario - Given a WP install - When I run `wp plugin install akismet` - Then STDERR should be empty -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-stderr-should-not-be-a-number.md b/behat-steps/then-stdout-stderr-should-not-be-a-number.md deleted file mode 100644 index ff55a876..00000000 --- a/behat-steps/then-stdout-stderr-should-not-be-a-number.md +++ /dev/null @@ -1,83 +0,0 @@ -# Then /^(STDOUT|STDERR) should not be a number$/ - -Expect STDOUT or STDERR to not be a numeric value. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation - When I run `wp post list --format=json` - Then STDOUT should not be a number -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-stderr-should-not-be-empty.md b/behat-steps/then-stdout-stderr-should-not-be-empty.md deleted file mode 100644 index 73938bfe..00000000 --- a/behat-steps/then-stdout-stderr-should-not-be-empty.md +++ /dev/null @@ -1,82 +0,0 @@ -# Then /^(STDOUT|STDERR) should not be empty$/ - -Expect STDOUT or STDERR not to be empty. - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp user create examplejane jane@example.com` - Then STDOUT should not be empty -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-stderr-should-not-match.md b/behat-steps/then-stdout-stderr-should-not-match.md deleted file mode 100644 index f426ba9b..00000000 --- a/behat-steps/then-stdout-stderr-should-not-match.md +++ /dev/null @@ -1,82 +0,0 @@ -# Then /^(STDOUT|STDERR) should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/ - -Match STDOUT or STDERR against a regex. - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp dist-archive wp-content/plugins/hello-world` - Then STDOUT should match /^Success: Created hello-world.0.1.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-stdout-stderr-should-strictly-be-contain-not-contain.md b/behat-steps/then-stdout-stderr-should-strictly-be-contain-not-contain.md deleted file mode 100644 index 8a604b9b..00000000 --- a/behat-steps/then-stdout-stderr-should-strictly-be-contain-not-contain.md +++ /dev/null @@ -1,92 +0,0 @@ -# Then /^(STDOUT|STDERR) should( strictly)? (be|contain|not contain):$/ - -Check the contents of STDOUT or STDERR. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given an empty directory - When I run `wp core is-installed` - Then STDOUT should be empty - -Scenario: My other scenario - Given a WP install - When I run `wp plugin install akismet` - Then STDOUT should contain: - """ - Plugin installed successfully. - """ - And STDERR should be empty -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-the-contents-of-the-file-should-not-match.md b/behat-steps/then-the-contents-of-the-file-should-not-match.md deleted file mode 100644 index 0b1cf753..00000000 --- a/behat-steps/then-the-contents-of-the-file-should-not-match.md +++ /dev/null @@ -1,82 +0,0 @@ -# Then /^the contents of the (.+) file should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/ - -Match file contents against a regex. - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp scaffold plugin hello-world` - Then the contents of the wp-content/plugins/hello-world/languages/hello-world.pot file should match /X-Generator:\s/ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-the-file-directory-should-strictly-exist-not-exist-be-contain-not-contain.md b/behat-steps/then-the-file-directory-should-strictly-exist-not-exist-be-contain-not-contain.md deleted file mode 100644 index ce586a56..00000000 --- a/behat-steps/then-the-file-directory-should-strictly-exist-not-exist-be-contain-not-contain.md +++ /dev/null @@ -1,92 +0,0 @@ -# Then /^the (.+) (file|directory) should( strictly)? (exist|not exist|be:|contain:|not contain:)$/ - -Expect a certain file or directory to (not) exist or (not) contain certain contents. - - -*** - -## Usage - -``` -Scenario: My example scenario - When I run `wp core download` - Then the wp-settings.php file should exist - And the wp-content directory should exist - And the {RUN_DIR} directory should contain: - """ - index.php - license.txt - """ - And the wp-config.php file should contain: - """ - That's all, stop editing! Happy publishing. - """ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-the-http-status-code-should-be-code.md b/behat-steps/then-the-http-status-code-should-be-code.md deleted file mode 100644 index 6f1d4220..00000000 --- a/behat-steps/then-the-http-status-code-should-be-code.md +++ /dev/null @@ -1,83 +0,0 @@ -# Then the HTTP status code should be :code - -Expect the HTTP status code for visiting `http://localhost:8080`. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation with Composer - And a PHP built-in web server to serve 'WordPress' - Then the HTTP status code should be 200 -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/then-the-return-code-should-not-be.md b/behat-steps/then-the-return-code-should-not-be.md deleted file mode 100644 index a494445a..00000000 --- a/behat-steps/then-the-return-code-should-not-be.md +++ /dev/null @@ -1,83 +0,0 @@ -# Then /^the return code should( not)? be (\d+)$/ - -Expect a specific exit code of the previous command. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP installation - When I try `wp plugin install` - Then the return code should be 1 -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/when-i-launch-in-the-background.md b/behat-steps/when-i-launch-in-the-background.md deleted file mode 100644 index feac22c3..00000000 --- a/behat-steps/when-i-launch-in-the-background.md +++ /dev/null @@ -1,41 +0,0 @@ -# When /^I launch in the background `([^`]+)`$/ - -Launch a given command in the background. - - -*** - -## Usage - -``` -Scenario: My example scenario - Given a WP install - And I launch in the background `wp server --host=localhost --port=8181` - ... -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/when-i-run-try-from.md b/behat-steps/when-i-run-try-from.md deleted file mode 100644 index 9fe5657f..00000000 --- a/behat-steps/when-i-run-try-from.md +++ /dev/null @@ -1,45 +0,0 @@ -# When /^I (run|try) `([^`]+)` from '([^\s]+)'$/ - -Run or try a given command in a subdirectory. - - -*** - -## Usage - -`run` expects an exit code 0, whereas `try` allows for non-zero exit codes. - -``` -Scenario: My example scenario - When I run `wp core is-installed` - Then STDOUT should be empty - - When I run `wp core is-installed` from 'foo/wp-content' - Then STDOUT should be empty -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/when-i-run-try-the-previous-command-again.md b/behat-steps/when-i-run-try-the-previous-command-again.md deleted file mode 100644 index b840cef6..00000000 --- a/behat-steps/when-i-run-try-the-previous-command-again.md +++ /dev/null @@ -1,51 +0,0 @@ -# When /^I (run|try) the previous command again$/ - -Run or try the previous command again. - - -*** - -## Usage - -`run` expects an exit code 0, whereas `try` allows for non-zero exit codes. - -``` -Scenario: My example scenario - When I run `wp site option update admin_user_id 1` - Then STDOUT should contain: - """ - Success: Updated 'admin_user_id' site option. - """ - - When I run the previous command again - Then STDOUT should contain: - """ - Success: Value passed for 'admin_user_id' site option is unchanged. - """ -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/behat-steps/when-i-run-try.md b/behat-steps/when-i-run-try.md deleted file mode 100644 index d6316d4a..00000000 --- a/behat-steps/when-i-run-try.md +++ /dev/null @@ -1,55 +0,0 @@ -# When /^I (run|try) `([^`]+)`$/ - -Run or try a given command. - - -*** - -## Usage - -`run` expects an exit code 0, whereas `try` allows for non-zero exit codes. - -So if using `run` and the command errors, the step will fail. - -``` -Scenario: My example scenario - When I run `wp core version` - Then STDOUT should contain: - """ - 6.8 - """ - -Scenario: My other scenario - When I try `wp i18n make-pot foo bar/baz.pot` - Then STDERR should contain: - """ - Error: Not a valid source directory. - """ - And the return code should be 1 -``` - - -*Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/bin/Handbook_Command.php b/bin/Handbook_Command.php index 1f2bae45..c8385efe 100644 --- a/bin/Handbook_Command.php +++ b/bin/Handbook_Command.php @@ -113,7 +113,7 @@ public function gen_api_docs() { EOT; - self::empty_dir( self::get_handbook_path() . '/internal-api/' ); + self::empty_dir( self::get_handbook_path() . '/references/internal-api/' ); foreach ( $categories as $name => $apis ) { $out .= '## ' . $name . PHP_EOL . PHP_EOL; @@ -138,7 +138,7 @@ function ( $parameter ) { $api['has_related'] = ! empty( $api['related'] ); $api_doc = self::render( 'internal-api.mustache', $api ); - $path = self::get_handbook_path() . "/internal-api/{$api['api_slug']}.md"; + $path = self::get_handbook_path() . "/references/internal-api/{$api['api_slug']}.md"; if ( ! is_dir( dirname( $path ) ) ) { mkdir( dirname( $path ) ); } @@ -147,7 +147,7 @@ function ( $parameter ) { $out .= PHP_EOL . PHP_EOL; } - file_put_contents( self::get_handbook_path() . '/internal-api.md', $out ); + file_put_contents( self::get_handbook_path() . '/references/internal-api.md', $out ); WP_CLI::success( 'Generated internal-api/' ); } @@ -190,7 +190,7 @@ public function gen_behat_docs() { EOT; - self::empty_dir( self::get_handbook_path() . '/behat-steps/' ); + self::empty_dir( self::get_handbook_path() . '/references/behat-steps/' ); foreach ( $categories as $name => $apis ) { $out .= '## ' . $name . PHP_EOL . PHP_EOL; @@ -215,7 +215,7 @@ function ( $parameter ) { $api['has_related'] = ! empty( $api['related'] ); $api_doc = self::render( 'behat-steps.mustache', $api ); - $path = self::get_handbook_path() . "/behat-steps/{$api['api_slug']}.md"; + $path = self::get_handbook_path() . "/references/behat-steps/{$api['api_slug']}.md"; if ( ! is_dir( dirname( $path ) ) ) { mkdir( dirname( $path ) ); } @@ -224,7 +224,7 @@ function ( $parameter ) { $out .= PHP_EOL . PHP_EOL; } - file_put_contents( self::get_handbook_path() . '/behat-steps.md', $out ); + file_put_contents( self::get_handbook_path() . '/references/behat-steps.md', $out ); WP_CLI::success( 'Generated behat-steps/' ); } diff --git a/bin/handbook-manifest.json b/bin/handbook-manifest.json index a6b98703..7d7f782f 100644 --- a/bin/handbook-manifest.json +++ b/bin/handbook-manifest.json @@ -221,12 +221,6 @@ "markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/references\/behat-steps\/given-a-wp-installation.md", "parent": "behat-steps" }, - "given-a-wp-installation-in": { - "title": "Given \/^a WP( [^\\s]+)? install(?:ation)? in ['"]?([^'"]+)['"]?$\/", - "slug": "given-a-wp-installation-in", - "markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/behat-steps\/given-a-wp-installation-in.md", - "parent": "behat-steps" - }, "given-a-wp-installation-in-subdir": { "title": "Given a WP install(ation) in :subdir", "slug": "given-a-wp-installation-in-subdir", diff --git a/internal-api.md b/internal-api.md deleted file mode 100644 index c42b3347..00000000 --- a/internal-api.md +++ /dev/null @@ -1,180 +0,0 @@ -# Internal API - -WP-CLI includes a number of utilities which are considered stable and meant to be used by commands. - -This also means functions and methods not listed here are considered part of the private API. They may change or disappear at any time. - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - -*** -## Registration - - - - -## Output - - - - -## Input - - - - -## Execution - - - - -## System - - - - -## Misc - - - - diff --git a/internal-api/wp-cli-add-command.md b/internal-api/wp-cli-add-command.md deleted file mode 100644 index 4231cac0..00000000 --- a/internal-api/wp-cli-add-command.md +++ /dev/null @@ -1,77 +0,0 @@ -# WP_CLI::add_command() - -Register a command to WP-CLI. - -*** - -## Usage - - WP_CLI::add_command( $name, $callable, $args = [] ) - -
-$name (string) Name for the command (e.g. "post list" or "site empty").
-$callable (callable|object|string|string[]) Command implementation as a class, function or closure.
-$args (array) {
Optional. An associative array with additional registration parameters.
@type callable $before_invoke Callback to execute before invoking the command.
@type callable $after_invoke Callback to execute after invoking the command.
@type string $shortdesc Short description (80 char or less) for the command.
@type string $longdesc Description of arbitrary length for examples, etc.
@type string $synopsis The synopsis for the command (string or array).
@type string $when Execute callback on a named WP-CLI hook (e.g. before_wp_load).
@type bool $is_deferred Whether the command addition had already been deferred.
}
-@return (bool) on success, false if deferred, hard error if registration failed.
-
- - -*** - -## Notes - -WP-CLI supports using any callable class, function, or closure as a -command. `WP_CLI::add_command()` is used for both internal and -third-party command registration. - -Command arguments are parsed from PHPDoc by default, but also can be -supplied as an optional third argument during registration. - -``` -# Register a custom 'foo' command to output a supplied positional param. -# -# $ wp foo bar --append=qux -# Success: bar qux - -/** - * My awesome closure command - * - * - * : An awesome message to display - * - * --append= - * : An awesome message to append to the original message. - * - * @when before_wp_load - */ -$foo = function( $args, $assoc_args ) { - WP_CLI::success( $args[0] . ' ' . $assoc_args['append'] ); -}; -WP_CLI::add_command( 'foo', $foo ); -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-add-hook.md b/internal-api/wp-cli-add-hook.md deleted file mode 100644 index 49a1b3b4..00000000 --- a/internal-api/wp-cli-add-hook.md +++ /dev/null @@ -1,83 +0,0 @@ -# WP_CLI::add_hook() - -Schedule a callback to be executed at a certain point. - -*** - -## Usage - - WP_CLI::add_hook( $when, $callback ) - -
-$when (string) Identifier for the hook.
-$callback (callable) Callback to execute when hook is called.
-@return (void)
-
- - -*** - -## Notes - -Hooks conceptually are very similar to WordPress actions. WP-CLI hooks -are typically called before WordPress is loaded. - -WP-CLI hooks include: - -* `before_add_command:` - Before the command is added. -* `after_add_command:` - After the command was added. -* `before_invoke:` (1) - Just before a command is invoked. -* `after_invoke:` (1) - Just after a command is invoked. -* `find_command_to_run_pre` - Just before WP-CLI finds the command to run. -* `before_registering_contexts` (1) - Before the contexts are registered. -* `before_wp_load` - Just before the WP load process begins. -* `before_wp_config_load` - After wp-config.php has been located. -* `after_wp_config_load` - After wp-config.php has been loaded into scope. -* `after_wp_load` - Just after the WP load process has completed. -* `before_run_command` (3) - Just before the command is executed. - -The parentheses behind the hook name denote the number of arguments -being passed into the hook. For such hooks, the callback should return -the first argument again, making them work like a WP filter. - -WP-CLI commands can create their own hooks with `WP_CLI::do_hook()`. - -If additional arguments are passed through the `WP_CLI::do_hook()` call, -these will be passed on to the callback provided by `WP_CLI::add_hook()`. - -``` -# `wp network meta` confirms command is executing in multisite context. -WP_CLI::add_command( 'network meta', 'Network_Meta_Command', array( - 'before_invoke' => function ( $name ) { - if ( !is_multisite() ) { - WP_CLI::error( 'This is not a multisite installation.' ); - } - } -) ); -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-add-wp-hook.md b/internal-api/wp-cli-add-wp-hook.md deleted file mode 100644 index 6ce696e3..00000000 --- a/internal-api/wp-cli-add-wp-hook.md +++ /dev/null @@ -1,52 +0,0 @@ -# WP_CLI::add_wp_hook() - -Add a callback to a WordPress action or filter. - -*** - -## Usage - - WP_CLI::add_wp_hook( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) - -
-$tag (string) Named WordPress action or filter.
-$function_to_add (callable) Callable to execute when the action or filter is evaluated.
-$priority (integer) Priority to add the callback as.
-$accepted_args (integer) Number of arguments to pass to callback.
-@return (true)
-
- - -*** - -## Notes - -`add_action()` without needing access to `add_action()`. If WordPress is -already loaded though, you should use `add_action()` (and `add_filter()`) -instead. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-colorize.md b/internal-api/wp-cli-colorize.md deleted file mode 100644 index 6acbed2d..00000000 --- a/internal-api/wp-cli-colorize.md +++ /dev/null @@ -1,110 +0,0 @@ -# WP_CLI::colorize() - -Colorize a string for output. - -*** - -## Usage - - WP_CLI::colorize( $string ) - -
-$string (string) String to colorize for output, with color tokens.
-@return (string) string.
-
- - -*** - -## Notes - -Yes, you can change the color of command line text too. For instance, -here's how `WP_CLI::success()` colorizes "Success: " - -``` -WP_CLI::colorize( "%GSuccess:%n " ) -``` - -Uses `\cli\Colors::colorize()` to transform color tokens to display -settings. Choose from the following tokens (and note 'reset'): - -* %y => ['color' => 'yellow'], -* %g => ['color' => 'green'], -* %b => ['color' => 'blue'], -* %r => ['color' => 'red'], -* %p => ['color' => 'magenta'], -* %m => ['color' => 'magenta'], -* %c => ['color' => 'cyan'], -* %w => ['color' => 'grey'], -* %k => ['color' => 'black'], -* %n => ['color' => 'reset'], -* %Y => ['color' => 'yellow', 'style' => 'bright'], -* %G => ['color' => 'green', 'style' => 'bright'], -* %B => ['color' => 'blue', 'style' => 'bright'], -* %R => ['color' => 'red', 'style' => 'bright'], -* %P => ['color' => 'magenta', 'style' => 'bright'], -* %M => ['color' => 'magenta', 'style' => 'bright'], -* %C => ['color' => 'cyan', 'style' => 'bright'], -* %W => ['color' => 'grey', 'style' => 'bright'], -* %K => ['color' => 'black', 'style' => 'bright'], -* %N => ['color' => 'reset', 'style' => 'bright'], -* %3 => ['background' => 'yellow'], -* %2 => ['background' => 'green'], -* %4 => ['background' => 'blue'], -* %1 => ['background' => 'red'], -* %5 => ['background' => 'magenta'], -* %6 => ['background' => 'cyan'], -* %7 => ['background' => 'grey'], -* %0 => ['background' => 'black'], -* %F => ['style' => 'blink'], -* %U => ['style' => 'underline'], -* %8 => ['style' => 'inverse'], -* %9 => ['style' => 'bright'], -* %_ => ['style' => 'bright'] - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-confirm.md b/internal-api/wp-cli-confirm.md deleted file mode 100644 index 1e081ea6..00000000 --- a/internal-api/wp-cli-confirm.md +++ /dev/null @@ -1,66 +0,0 @@ -# WP_CLI::confirm() - -Ask for confirmation before running a destructive operation. - -*** - -## Usage - - WP_CLI::confirm( $question, $assoc_args = [] ) - -
-$question (string) Question to display before the prompt.
-$assoc_args (array) Skips prompt if 'yes' is provided.
-
- - -*** - -## Notes - -If 'y' is provided to the question, the script execution continues. If -'n' or any other response is provided to the question, script exits. - -``` -# `wp db drop` asks for confirmation before dropping the database. - -WP_CLI::confirm( "Are you sure you want to drop the database?", $assoc_args ); -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-debug.md b/internal-api/wp-cli-debug.md deleted file mode 100644 index a809fb34..00000000 --- a/internal-api/wp-cli-debug.md +++ /dev/null @@ -1,86 +0,0 @@ -# WP_CLI::debug() - -Display debug message prefixed with "Debug: " when `--debug` is used. - -*** - -## Usage - - WP_CLI::debug( $message, $group = false ) - -
-$message (string|WP_Error|Exception|Throwable) Message to write to STDERR.
-$group (string|bool) Organize debug message to a specific group.
Use `false` to not group the message.
-@return (void)
-
- - -*** - -## Notes - -Debug message is written to STDERR, and includes script execution time. - -Helpful for optionally showing greater detail when needed. Used throughout -WP-CLI bootstrap process for easier debugging and profiling. - -``` -# Called in `WP_CLI\Runner::set_wp_root()`. -private static function set_wp_root( $path ) { - define( 'ABSPATH', Utils\trailingslashit( $path ) ); - WP_CLI::debug( 'ABSPATH defined: ' . ABSPATH ); - $_SERVER['DOCUMENT_ROOT'] = realpath( $path ); -} - -# Debug details only appear when `--debug` is used. -# $ wp --debug -# [...] -# Debug: ABSPATH defined: /srv/www/wordpress-develop.dev/src/ (0.225s) -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-do-hook.md b/internal-api/wp-cli-do-hook.md deleted file mode 100644 index 5b3142cc..00000000 --- a/internal-api/wp-cli-do-hook.md +++ /dev/null @@ -1,49 +0,0 @@ -# WP_CLI::do_hook() - -Execute callbacks registered to a given hook. - -*** - -## Usage - - WP_CLI::do_hook( $when, $args ) - -
-$when (string) Identifier for the hook.
-...$args (mixed) Optional. Arguments that will be passed onto the
callback provided by `WP_CLI::add_hook()`.
-@return (null|mixed) the first optional argument if optional<br /> arguments were passed, otherwise returns null.
-
- - -*** - -## Notes - -See `WP_CLI::add_hook()` for details on WP-CLI's internal hook system. -Commands can provide and call their own hooks. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-error-multi-line.md b/internal-api/wp-cli-error-multi-line.md deleted file mode 100644 index f5437cf1..00000000 --- a/internal-api/wp-cli-error-multi-line.md +++ /dev/null @@ -1,67 +0,0 @@ -# WP_CLI::error_multi_line() - -Display a multi-line error message in a red box. Doesn't exit script. - -*** - -## Usage - - WP_CLI::error_multi_line( $message_lines ) - -
-$message_lines (array) Multi-line error message to be displayed.
-
- - -*** - -## Notes - -Error message is written to STDERR. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-error.md b/internal-api/wp-cli-error.md deleted file mode 100644 index 9c379cff..00000000 --- a/internal-api/wp-cli-error.md +++ /dev/null @@ -1,84 +0,0 @@ -# WP_CLI::error() - -Display error message prefixed with "Error: " and exit script. - -*** - -## Usage - - WP_CLI::error( $message, $exit = true ) - -
-$message (string|WP_Error|Exception|Throwable) Message to write to STDERR.
-$exit (boolean|integer) True defaults to exit(1).
-@return (null)
-
- - -*** - -## Notes - -Error message is written to STDERR. Defaults to halting script execution -with return code 1. - -Use `WP_CLI::warning()` instead when script execution should be permitted -to continue. - -When `--debug` is enabled, this method will also output a backtrace -showing where the error was triggered from, making it easier to identify -problematic code. - -``` -# `wp cache flush` considers flush failure to be a fatal error. -if ( false === wp_cache_flush() ) { - WP_CLI::error( 'The object cache could not be flushed.' ); -} -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-get-config.md b/internal-api/wp-cli-get-config.md deleted file mode 100644 index 463fc878..00000000 --- a/internal-api/wp-cli-get-config.md +++ /dev/null @@ -1,64 +0,0 @@ -# WP_CLI::get_config() - -Get values of global configuration parameters. - -*** - -## Usage - - WP_CLI::get_config( $key = null ) - -
-$key (string) Get value for a specific global configuration parameter.
-@return (mixed)
-
- - -*** - -## Notes - -Provides access to `--path=`, `--url=`, and other values of -the [global configuration parameters](https://make.wordpress.org/cli/handbook/references/config/). - -``` -WP_CLI::log( 'The --url= value is: ' . WP_CLI::get_config( 'url' ) ); -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-get-php-binary.md b/internal-api/wp-cli-get-php-binary.md deleted file mode 100644 index e9edb746..00000000 --- a/internal-api/wp-cli-get-php-binary.md +++ /dev/null @@ -1,54 +0,0 @@ -# WP_CLI::get_php_binary() - -Get the path to the PHP binary used when executing WP-CLI. - -*** - -## Usage - - WP_CLI::get_php_binary() - -
-@return (string)
-
- - -*** - -## Notes - -Environment values permit specific binaries to be indicated. - -Note: moved to Utils, left for BC. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-halt.md b/internal-api/wp-cli-halt.md deleted file mode 100644 index 22bbdf0e..00000000 --- a/internal-api/wp-cli-halt.md +++ /dev/null @@ -1,72 +0,0 @@ -# WP_CLI::halt() - -Halt script execution with a specific return code. - -*** - -## Usage - - WP_CLI::halt( $return_code ) - -
-$return_code (integer)
-@return (never)
-
- - -*** - -## Notes - -Permits script execution to be overloaded by `WP_CLI::runcommand()` - -When `--debug` is enabled, this method will also output a backtrace -showing where the halt was triggered from, making it easier to identify -the cause of early termination. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-has-config.md b/internal-api/wp-cli-has-config.md deleted file mode 100644 index 3bd24c03..00000000 --- a/internal-api/wp-cli-has-config.md +++ /dev/null @@ -1,52 +0,0 @@ -# WP_CLI::has_config() - -Confirm that a global configuration parameter does exist. - -*** - -## Usage - - WP_CLI::has_config( $key ) - -
-$key (string) Config parameter key to check.
-@return (bool)
-
- - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-launch-self.md b/internal-api/wp-cli-launch-self.md deleted file mode 100644 index 0a4dc53c..00000000 --- a/internal-api/wp-cli-launch-self.md +++ /dev/null @@ -1,57 +0,0 @@ -# WP_CLI::launch_self() - -Run a WP-CLI command in a new process reusing the current runtime arguments. - -*** - -## Usage - - WP_CLI::launch_self( $command, $args = [], $assoc_args = [], $exit_on_error = true, $return_detailed = false, $runtime_args = [] ) - -
-$command (string) WP-CLI command to call.
-$args (array) Positional arguments to include when calling the command.
-$assoc_args (array) Associative arguments to include when calling the command.
-$exit_on_error (bool) Whether to exit if the command returns an elevated return code.
-$return_detailed (bool) Whether to return an exit status (default) or detailed execution results.
-$runtime_args (array) Override one or more global args (path,url,user,allow-root)
-@return (int|ProcessRun) command exit status, or a ProcessRun instance
-
- - -*** - -## Notes - -Use `WP_CLI::runcommand()` instead, which is easier to use and works better. - -Note: While this command does persist a limited set of runtime arguments, -it *does not* persist environment variables. Practically speaking, WP-CLI -packages won't be loaded when using WP_CLI::launch_self() because the -launched process doesn't have access to the current process $HOME. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-launch.md b/internal-api/wp-cli-launch.md deleted file mode 100644 index bad9b273..00000000 --- a/internal-api/wp-cli-launch.md +++ /dev/null @@ -1,56 +0,0 @@ -# WP_CLI::launch() - -Launch an arbitrary external process that takes over I/O. - -*** - -## Usage - - WP_CLI::launch( $command, $exit_on_error = true, $return_detailed = false ) - -
-$command (string) External process to launch.
-$exit_on_error (boolean) Whether to exit if the command returns an elevated return code.
-$return_detailed (boolean) Whether to return an exit status (default) or detailed execution results.
-@return (int|ProcessRun) command exit status, or a ProcessRun object for full details.
-
- - -*** - -## Notes - -``` -# `wp core download` falls back to the `tar` binary when PharData isn't available -if ( ! class_exists( 'PharData' ) ) { - $cmd = "tar xz --strip-components=1 --directory=%s -f $tarball"; - WP_CLI::launch( Utils\esc_cmd( $cmd, $dest ) ); - return; -} -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-line.md b/internal-api/wp-cli-line.md deleted file mode 100644 index f7a081ee..00000000 --- a/internal-api/wp-cli-line.md +++ /dev/null @@ -1,69 +0,0 @@ -# WP_CLI::line() - -Display informational message without prefix, and ignore `--quiet`. - -*** - -## Usage - - WP_CLI::line( $message = '' ) - -
-$message (string) Message to display to the end user.
-@return (void)
-
- - -*** - -## Notes - -Message is written to STDOUT. `WP_CLI::log()` is typically recommended; -`WP_CLI::line()` is included for historical compat. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-log.md b/internal-api/wp-cli-log.md deleted file mode 100644 index 256275c3..00000000 --- a/internal-api/wp-cli-log.md +++ /dev/null @@ -1,72 +0,0 @@ -# WP_CLI::log() - -Display informational message without prefix. - -*** - -## Usage - - WP_CLI::log( $message ) - -
-$message (string) Message to write to STDOUT.
-
- - -*** - -## Notes - -Message is written to STDOUT, or discarded when `--quiet` flag is supplied. - -``` -# `wp cli update` lets user know of each step in the update process. -WP_CLI::log( sprintf( 'Downloading from %s...', $download_url ) ); -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-read-value.md b/internal-api/wp-cli-read-value.md deleted file mode 100644 index a51843fa..00000000 --- a/internal-api/wp-cli-read-value.md +++ /dev/null @@ -1,52 +0,0 @@ -# WP_CLI::read_value() - -Read a value, from various formats. - -*** - -## Usage - - WP_CLI::read_value( $raw_value, $assoc_args = [] ) - -
-$raw_value (string)
-$assoc_args (array)
-
- - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-run-command.md b/internal-api/wp-cli-run-command.md deleted file mode 100644 index 7f2fb426..00000000 --- a/internal-api/wp-cli-run-command.md +++ /dev/null @@ -1,57 +0,0 @@ -# WP_CLI::run_command() - -Run a given command within the current process using the same global parameters. - -*** - -## Usage - - WP_CLI::run_command( $args, $assoc_args = [] ) - -
-$args (array) Positional arguments including command name.
-$assoc_args (array)
-
- - -*** - -## Notes - -Use `WP_CLI::runcommand()` instead, which is easier to use and works better. - -To run a command using a new process with the same global parameters, -use WP_CLI::launch_self(). To run a command using a new process with -different global parameters, use WP_CLI::launch(). - -``` -ob_start(); -WP_CLI::run_command( array( 'cli', 'cmd-dump' ) ); -$ret = ob_get_clean(); -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-runcommand.md b/internal-api/wp-cli-runcommand.md deleted file mode 100644 index 49366c0d..00000000 --- a/internal-api/wp-cli-runcommand.md +++ /dev/null @@ -1,66 +0,0 @@ -# WP_CLI::runcommand() - -Run a WP-CLI command. - -*** - -## Usage - - WP_CLI::runcommand( $command, $options = [] ) - -
-$command (string) WP-CLI command to run, including arguments.
-$options (array) {
Configuration options for command execution.
@type bool $launch Launches a new process (true) or reuses the existing process (false). Default: true.
@type bool $exit_error Halts the script on error. Default: true.
@type bool|string $return Returns output as an object when set to 'all' (string), return just the 'stdout', 'stderr', or 'return_code' (string) of command, or print directly to stdout/stderr (false). Default: false.
@type bool|string $parse Parse returned output as 'json' (string); otherwise, output is unchanged (false). Default: false.
@type array $command_args Contains additional command line arguments for the command. Each element represents a single argument. Default: empty array.
}
-@return (mixed)
-
- - -*** - -## Notes - -Launches a new child process to run a specified WP-CLI command. -Optionally: - -* Run the command in an existing process. -* Prevent halting script execution on error. -* Capture and return STDOUT, or full details about command execution. -* Parse JSON output if the command rendered it. -* Include additional arguments that are passed to the command. - -``` -$options = array( - 'return' => true, // Return 'STDOUT'; use 'all' for full object. - 'parse' => 'json', // Parse captured STDOUT to JSON array. - 'launch' => false, // Reuse the current process. - 'exit_error' => true, // Halt script execution on error. - 'command_args' => [ '--skip-themes' ], // Additional arguments to be passed to the $command. -); -$plugins = WP_CLI::runcommand( 'plugin list --format=json', $options ); -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - -
    - - - -
  • WP_CLI::launch() - Launch an arbitrary external process that takes over I/O.
  • - - -
  • WP_CLI::launch_self() - Run a WP-CLI command in a new process reusing the current runtime arguments.
  • - - -
  • WP_CLI::run_command() - Run a given command within the current process using the same global parameters.
  • - - - -
- - diff --git a/internal-api/wp-cli-success.md b/internal-api/wp-cli-success.md deleted file mode 100644 index 46d5ceaa..00000000 --- a/internal-api/wp-cli-success.md +++ /dev/null @@ -1,80 +0,0 @@ -# WP_CLI::success() - -Display success message prefixed with "Success: ". - -*** - -## Usage - - WP_CLI::success( $message ) - -
-$message (string) Message to write to STDOUT.
-@return (void)
-
- - -*** - -## Notes - -Success message is written to STDOUT, or discarded when `--quiet` flag is supplied. - -Typically recommended to inform user of successful script conclusion. - -``` -# wp rewrite flush expects 'rewrite_rules' option to be set after flush. -flush_rewrite_rules( \WP_CLI\Utils\get_flag_value( $assoc_args, 'hard' ) ); -if ( ! get_option( 'rewrite_rules' ) ) { - WP_CLI::warning( "Rewrite rules are empty." ); -} else { - WP_CLI::success( 'Rewrite rules flushed.' ); -} -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-basename.md b/internal-api/wp-cli-utils-basename.md deleted file mode 100644 index bf8a6d88..00000000 --- a/internal-api/wp-cli-utils-basename.md +++ /dev/null @@ -1,53 +0,0 @@ -# WP_CLI\Utils\basename() - -Locale-independent version of basename() - -*** - -## Usage - - WP_CLI\Utils\basename( $path, $suffix = '' ) - -
-$path (string)
-$suffix (string)
-@return (string)
-
- - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-esc-like.md b/internal-api/wp-cli-utils-esc-like.md deleted file mode 100644 index a7df1777..00000000 --- a/internal-api/wp-cli-utils-esc-like.md +++ /dev/null @@ -1,61 +0,0 @@ -# WP_CLI\Utils\esc_like() - -First half of escaping for LIKE special characters % and _ before preparing for MySQL. - -*** - -## Usage - - WP_CLI\Utils\esc_like( $text ) - -
-$text (string) The raw text to be escaped. The input typed by the user should have no
extra or deleted slashes.
-@return (string) in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()<br /> or real_escape next.
-
- - -*** - -## Notes - -Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security. - -Copied from core "wp-includes/wp-db.php". Avoids dependency on WP 4.4 wpdb. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-format-items.md b/internal-api/wp-cli-utils-format-items.md deleted file mode 100644 index 8efc5798..00000000 --- a/internal-api/wp-cli-utils-format-items.md +++ /dev/null @@ -1,101 +0,0 @@ -# WP_CLI\Utils\format_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 comma-separated list.
-
- - -*** - -## Notes - -Given a collection of items with a consistent data structure: - -``` -$items = array( - array( - 'key' => 'foo', - 'value' => 'bar', - ) -); -``` - -Render `$items` as an ASCII table: - -``` -WP_CLI\Utils\format_items( 'table', $items, array( 'key', 'value' ) ); - -# +-----+-------+ -# | key | value | -# +-----+-------+ -# | foo | bar | -# +-----+-------+ -``` - -Or render `$items` as YAML: - -``` -WP_CLI\Utils\format_items( 'yaml', $items, array( 'key', 'value' ) ); - -# --- -# - -# key: foo -# value: bar -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-get-flag-value.md b/internal-api/wp-cli-utils-get-flag-value.md deleted file mode 100644 index 1c56275a..00000000 --- a/internal-api/wp-cli-utils-get-flag-value.md +++ /dev/null @@ -1,63 +0,0 @@ -# WP_CLI\Utils\get_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 provides a safer alternative to using -`isset( $assoc_args['quiet'] )` or similar. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-get-home-dir.md b/internal-api/wp-cli-utils-get-home-dir.md deleted file mode 100644 index 43baf242..00000000 --- a/internal-api/wp-cli-utils-get-home-dir.md +++ /dev/null @@ -1,45 +0,0 @@ -# WP_CLI\Utils\get_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 - - - - diff --git a/internal-api/wp-cli-utils-get-named-sem-ver.md b/internal-api/wp-cli-utils-get-named-sem-ver.md deleted file mode 100644 index fb7053f4..00000000 --- a/internal-api/wp-cli-utils-get-named-sem-ver.md +++ /dev/null @@ -1,53 +0,0 @@ -# WP_CLI\Utils\get_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 - - - - diff --git a/internal-api/wp-cli-utils-get-php-binary.md b/internal-api/wp-cli-utils-get-php-binary.md deleted file mode 100644 index a16dc3b6..00000000 --- a/internal-api/wp-cli-utils-get-php-binary.md +++ /dev/null @@ -1,52 +0,0 @@ -# WP_CLI\Utils\get_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 - - - - diff --git a/internal-api/wp-cli-utils-get-temp-dir.md b/internal-api/wp-cli-utils-get-temp-dir.md deleted file mode 100644 index 38f05cce..00000000 --- a/internal-api/wp-cli-utils-get-temp-dir.md +++ /dev/null @@ -1,45 +0,0 @@ -# WP_CLI\Utils\get_temp_dir() - -Get the system's temp directory. Warns user if it isn't writable. - -*** - -## Usage - - WP_CLI\Utils\get_temp_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 - - - - diff --git a/internal-api/wp-cli-utils-http-request.md b/internal-api/wp-cli-utils-http-request.md deleted file mode 100644 index 44909c53..00000000 --- a/internal-api/wp-cli-utils-http-request.md +++ /dev/null @@ -1,72 +0,0 @@ -# WP_CLI\Utils\http_request() - -Make a HTTP request to a remote URL. - -*** - -## Usage - - WP_CLI\Utils\http_request( $method, $url, $data = null, $headers = [], $options = [] ) - -
-$method (string) HTTP method (GET, POST, DELETE, etc.).
-$url (string) URL to make the HTTP request to.
-$data (array|null) Data to send either as a query string for GET/HEAD requests,
or in the body for POST requests.
-$headers (array) Add specific headers to the request.
-$options (array) {
Optional. An associative array of additional request options.
@type bool $halt_on_error Whether or not command execution should be halted on error. Default: true
@type bool|string $verify A boolean to use enable/disable SSL verification
or string absolute path to CA cert to use.
Defaults to detected CA cert bundled with the Requests library.
@type bool $insecure Whether to retry automatically without certificate validation.
}
-@return (\Requests_Response|Response)
-
- - -*** - -## Notes - -Wraps the Requests HTTP library to ensure every request includes a cert. - -``` -# `wp core download` verifies the hash for a downloaded WordPress archive - -$md5_response = Utils\http_request( 'GET', $download_url . '.md5' ); -if ( 20 != substr( $md5_response->status_code, 0, 2 ) ) { - WP_CLI::error( "Couldn't access md5 hash for release (HTTP code {$response->status_code})" ); -} -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-ispiped.md b/internal-api/wp-cli-utils-ispiped.md deleted file mode 100644 index 5249cc6d..00000000 --- a/internal-api/wp-cli-utils-ispiped.md +++ /dev/null @@ -1,74 +0,0 @@ -# WP_CLI\Utils\isPiped() - -Checks whether the output of the current script is a TTY or a pipe / redirect - -*** - -## Usage - - WP_CLI\Utils\isPiped() - -
-@return (bool)
-
- - -*** - -## Notes - -Returns `true` if `STDOUT` output is being redirected to a pipe or a file; `false` is -output is being sent directly to the terminal. - -If an env variable `SHELL_PIPE` exists, the returned result depends on its -value. Strings like `1`, `0`, `yes`, `no`, that validate to booleans are accepted. - -To enable ASCII formatting even when the shell is piped, use the -ENV variable `SHELL_PIPE=0`. -``` -SHELL_PIPE=0 wp plugin list | cat -``` - -Note that the db command forwards to the mysql client, which is unaware of the env -variable. For db commands, pass the `--table` option instead. -``` -wp db query --table "SELECT 1" | cat -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-launch-editor-for-input.md b/internal-api/wp-cli-utils-launch-editor-for-input.md deleted file mode 100644 index 1e71083b..00000000 --- a/internal-api/wp-cli-utils-launch-editor-for-input.md +++ /dev/null @@ -1,54 +0,0 @@ -# WP_CLI\Utils\launch_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 from editor; false, if no change to file.
-
- - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-make-progress-bar.md b/internal-api/wp-cli-utils-make-progress-bar.md deleted file mode 100644 index 32687e43..00000000 --- a/internal-api/wp-cli-utils-make-progress-bar.md +++ /dev/null @@ -1,86 +0,0 @@ -# WP_CLI\Utils\make_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 written to STDOUT, and disabled when command is piped. Progress -advances with `$progress->tick()`, and completes with `$progress->finish()`. -Process bar also indicates elapsed time and expected total time. - -``` -# `wp user generate` ticks progress bar each time a new user is created. -# -# $ wp user generate --count=500 -# Generating users 22 % [=======> ] 0:05 / 0:23 - -$progress = \WP_CLI\Utils\make_progress_bar( 'Generating users', $count ); -for ( $i = 0; $i < $count; $i++ ) { - // uses wp_insert_user() to insert the user - $progress->tick(); -} -$progress->finish(); -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-normalize-path.md b/internal-api/wp-cli-utils-normalize-path.md deleted file mode 100644 index f0a88103..00000000 --- a/internal-api/wp-cli-utils-normalize-path.md +++ /dev/null @@ -1,57 +0,0 @@ -# WP_CLI\Utils\normalize_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 letters on Windows systems. - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-parse-ssh-url.md b/internal-api/wp-cli-utils-parse-ssh-url.md deleted file mode 100644 index 866da588..00000000 --- a/internal-api/wp-cli-utils-parse-ssh-url.md +++ /dev/null @@ -1,64 +0,0 @@ -# WP_CLI\Utils\parse_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 submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-parse-str-to-argv.md b/internal-api/wp-cli-utils-parse-str-to-argv.md deleted file mode 100644 index b8abf5aa..00000000 --- a/internal-api/wp-cli-utils-parse-str-to-argv.md +++ /dev/null @@ -1,52 +0,0 @@ -# WP_CLI\Utils\parse_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 - - - - diff --git a/internal-api/wp-cli-utils-proc-open-compat.md b/internal-api/wp-cli-utils-proc-open-compat.md deleted file mode 100644 index b65723f5..00000000 --- a/internal-api/wp-cli-utils-proc-open-compat.md +++ /dev/null @@ -1,58 +0,0 @@ -# WP_CLI\Utils\proc_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 file pointers that correspond to PHP's end of any pipes that are created.
-$cwd (string) Initial working directory for the command.
-string> (array<string,) $env Array of environment variables.
-$other_options (array<string>) Array of additional options (Windows only).
-array<int, (@param-out) resource> $pipes
-@return (resource|false) stripped of any environment variable settings, or false on failure.
-
- - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-report-batch-operation-results.md b/internal-api/wp-cli-utils-report-batch-operation-results.md deleted file mode 100644 index f3c66a45..00000000 --- a/internal-api/wp-cli-utils-report-batch-operation-results.md +++ /dev/null @@ -1,57 +0,0 @@ -# WP_CLI\Utils\report_batch_operation_results() - -Report the results of the same operation against multiple resources. - -*** - -## Usage - - WP_CLI\Utils\report_batch_operation_results( $noun, $verb, $total, $successes, $failures, $skips = null ) - -
-$noun (string) Resource being affected (e.g. plugin).
-$verb (string) Type of action happening to the noun (e.g. activate).
-$total (integer) Total number of resource being affected.
-$successes (integer) Number of successful operations.
-$failures (integer) Number of failures.
-$skips (null|integer) Optional. Number of skipped operations. Default null (don't show skips).
-@return (void)
-
- - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-trailingslashit.md b/internal-api/wp-cli-utils-trailingslashit.md deleted file mode 100644 index 0e2a2c0e..00000000 --- a/internal-api/wp-cli-utils-trailingslashit.md +++ /dev/null @@ -1,46 +0,0 @@ -# WP_CLI\Utils\trailingslashit() - -Appends a trailing slash. - -*** - -## Usage - - WP_CLI\Utils\trailingslashit( $string ) - -
-$string (string) What to add the trailing slash to.
-@return (string) with trailing slash added.
-
- - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-utils-write-csv.md b/internal-api/wp-cli-utils-write-csv.md deleted file mode 100644 index ef8137bb..00000000 --- a/internal-api/wp-cli-utils-write-csv.md +++ /dev/null @@ -1,53 +0,0 @@ -# WP_CLI\Utils\write_csv() - -Write data as CSV to a given file. - -*** - -## Usage - - WP_CLI\Utils\write_csv( $fd, $rows, $headers = [] ) - -
-$fd (resource) File descriptor.
-$rows (array<string[]>|iterable) Array of rows to output.
-$headers (array<string>) List of CSV columns (optional).
-
- - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - - diff --git a/internal-api/wp-cli-warning.md b/internal-api/wp-cli-warning.md deleted file mode 100644 index 60f31674..00000000 --- a/internal-api/wp-cli-warning.md +++ /dev/null @@ -1,81 +0,0 @@ -# WP_CLI::warning() - -Display warning message prefixed with "Warning: ". - -*** - -## Usage - - WP_CLI::warning( $message ) - -
-$message (string|WP_Error|Exception|Throwable) Message to write to STDERR.
-@return (void)
-
- - -*** - -## Notes - -Warning message is written to STDERR, or discarded when `--quiet` flag is supplied. - -Use instead of `WP_CLI::debug()` when script execution should be permitted -to continue. - -``` -# `wp plugin activate` skips activation when plugin is network active. -$status = $this->get_status( $plugin->file ); -// Network-active is the highest level of activation status -if ( 'active-network' === $status ) { - WP_CLI::warning( "Plugin '{$plugin->name}' is already network active." ); - continue; -} -``` - - -*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.* - - -*** - -## Related - - - -