Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions features/ability.feature
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ Feature: Manage abilities registered via the WordPress Abilities API.
"name":"test-plugin\/get-site-title"
"""

When I run `wp ability list --category=test-category --format=ids`
Then STDOUT should be:
"""
test-plugin/get-site-title test-plugin/echo-input
"""
And STDERR should be empty

@require-wp-6.9
Scenario: Get ability details.
Given a wp-content/mu-plugins/test-ability.php file:
Expand Down
6 changes: 6 additions & 0 deletions src/Ability_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ public function list_( $args, $assoc_args ): void {
}

$formatter = $this->get_formatter( $assoc_args, $this->default_fields );

// The ids format expects plain values, so pass the ability names.
if ( 'ids' === $formatter->format ) {
$items = wp_list_pluck( $items, 'name' );
}

$formatter->display_items( $items );
}

Expand Down
Loading