File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ # A class for WordPress option patch subcommand.
2+ define wp::option::patch (
3+ $location ,
4+ $key = $title,
5+ $key_path = undef ,
6+ $value = undef ,
7+ $ensure = present ,
8+ $format = ' plaintext' ,
9+ $user = $::wp::user,
10+ ) {
11+ include wp::cli
12+
13+ case $ensure {
14+ present: {
15+ $command = " insert ${key} ${key_path} ${value} --format=${format} "
16+ }
17+ equal: {
18+ if $value == undef {
19+ fail(' Option value must be specified' )
20+ }
21+ $command = " update ${key} ${key_path} ${value} "
22+ }
23+ absent: {
24+ $command = " delete ${key} ${key_path} "
25+ }
26+ default: {
27+ fail(' Invalid option operation' )
28+ }
29+ }
30+
31+ wp::command { "${location} option patch ${command}" :
32+ location => $location ,
33+ command => " option patch ${command} " ,
34+ user => $user ,
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments