Skip to content

Conversation

@ernilambar
Copy link
Member

Fixes #474

@ernilambar ernilambar requested a review from a team as a code owner February 23, 2024 06:55
@swissspidy swissspidy added this to the 2.6.3 milestone Feb 23, 2024
@swissspidy swissspidy added the command:user-application-password-list Related to 'user application-password list' command label Feb 23, 2024
@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
@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

Labels

command:user-application-password-list Related to 'user application-password list' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce ids as format for user application-password list

3 participants