Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce --format=ids in user application password list #475

Merged
merged 4 commits into from
Apr 26, 2024
Merged

Introduce --format=ids in user application password list #475

merged 4 commits into from
Apr 26, 2024

Conversation

ernilambar
Copy link
Member

Fixes #474

@ernilambar ernilambar requested a review from a team as a code owner February 23, 2024 06:55
@ernilambar
Copy link
Member Author

@swissspidy In Formatter, $assoc_args is passed by reference.

public function __construct( &$assoc_args, $fields = null, $prefix = false ) {

And it unsets the format key in the method. https://github.com/wp-cli/wp-cli/blob/main/php/WP_CLI/Formatter.php#L46

So, if we keep $formatter = new Formatter( $assoc_args, $fields ); before the conditional, if condition will never be true because we now dont have $assoc_args['format'].

@ernilambar
Copy link
Member Author

cc @danielbachhuber

@danielbachhuber danielbachhuber changed the title Introduce ids format in user application password list Introduce --format=ids in user application password list Mar 7, 2024
@schlessera
Copy link
Member

schlessera commented Mar 14, 2024

@ernilambar I suggest to go with the tweak that @swissspidy mentioned but also combine it with an early processing of the flag like so:

$format = Utils\get_flag_value( $assoc_args, 'format', 'table' );

This will avoid the breakage with @swissspidy 's refactor, and it will also make the conditional(s) cleaner.

@swissspidy swissspidy merged commit 8b19b7d into wp-cli:main Apr 26, 2024
36 checks passed
@ernilambar ernilambar deleted the 474-format-ids branch April 26, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce ids as format for user application-password list
3 participants