Skip to content

Commit 6eb56a9

Browse files
authored
Merge pull request #162 from wp-cli/159-improvements
2 parents 0940447 + 2300064 commit 6eb56a9

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,44 @@ wp config has <name> [--type=<type>] [--config-file=<path>]
250250

251251

252252

253+
### wp config is-true
254+
255+
Determines whether value of a specific defined constant or variable is truthy.
256+
257+
~~~
258+
wp config is-true <name> [--type=<type>] [--config-file=<path>]
259+
~~~
260+
261+
This determination is made by evaluating the retrieved value via boolval().
262+
263+
**OPTIONS**
264+
265+
<name>
266+
Name of the wp-config.php constant or variable.
267+
268+
[--type=<type>]
269+
Type of config value to retrieve. Defaults to 'all'.
270+
---
271+
default: all
272+
options:
273+
- constant
274+
- variable
275+
- all
276+
---
277+
278+
[--config-file=<path>]
279+
Specify the file path to the config file to be read. Defaults to the root of the
280+
WordPress installation and the filename "wp-config.php".
281+
282+
**EXAMPLES**
283+
284+
# Assert if MULTISITE is true
285+
$ wp config is-true MULTISITE
286+
$ echo $?
287+
0
288+
289+
290+
253291
### wp config list
254292

255293
Lists variables, constants, and file includes defined in wp-config.php file.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"config create",
4545
"config get",
4646
"config has",
47+
"config is-true",
4748
"config list",
4849
"config path",
4950
"config set",

src/Config_Command.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ public function get( $args, $assoc_args ) {
426426
}
427427

428428
/**
429-
* Determines whether value of a specific constant or variable defined is truthy.
429+
* Determines whether value of a specific defined constant or variable is truthy.
430+
*
430431
* This determination is made by evaluating the retrieved value via boolval().
431432
*
432433
* ## OPTIONS
@@ -452,7 +453,7 @@ public function get( $args, $assoc_args ) {
452453
*
453454
* # Assert if MULTISITE is true
454455
* $ wp config is-true MULTISITE
455-
* echo $?
456+
* $ echo $?
456457
* 0
457458
*
458459
* @subcommand is-true

0 commit comments

Comments
 (0)