Skip to content

Commit

Permalink
Merge pull request #162 from wp-cli/159-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Aug 24, 2023
2 parents 0940447 + 2300064 commit 6eb56a9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,44 @@ wp config has <name> [--type=<type>] [--config-file=<path>]



### wp config is-true

Determines whether value of a specific defined constant or variable is truthy.

~~~
wp config is-true <name> [--type=<type>] [--config-file=<path>]
~~~

This determination is made by evaluating the retrieved value via boolval().

**OPTIONS**

<name>
Name of the wp-config.php constant or variable.

[--type=<type>]
Type of config value to retrieve. Defaults to 'all'.
---
default: all
options:
- constant
- variable
- all
---

[--config-file=<path>]
Specify the file path to the config file to be read. Defaults to the root of the
WordPress installation and the filename "wp-config.php".

**EXAMPLES**

# Assert if MULTISITE is true
$ wp config is-true MULTISITE
$ echo $?
0



### wp config list

Lists variables, constants, and file includes defined in wp-config.php file.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"config create",
"config get",
"config has",
"config is-true",
"config list",
"config path",
"config set",
Expand Down
5 changes: 3 additions & 2 deletions src/Config_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ public function get( $args, $assoc_args ) {
}

/**
* Determines whether value of a specific constant or variable defined is truthy.
* Determines whether value of a specific defined constant or variable is truthy.
*
* This determination is made by evaluating the retrieved value via boolval().
*
* ## OPTIONS
Expand All @@ -452,7 +453,7 @@ public function get( $args, $assoc_args ) {
*
* # Assert if MULTISITE is true
* $ wp config is-true MULTISITE
* echo $?
* $ echo $?
* 0
*
* @subcommand is-true
Expand Down

0 comments on commit 6eb56a9

Please sign in to comment.