Skip to content

TableEmptyMessage attribute#5641

Open
greg-1-anderson wants to merge 1 commit into
12.xfrom
table-empty-message
Open

TableEmptyMessage attribute#5641
greg-1-anderson wants to merge 1 commit into
12.xfrom
table-empty-message

Conversation

@greg-1-anderson

@greg-1-anderson greg-1-anderson commented Jun 8, 2023

Copy link
Copy Markdown
Member

If this looks okay, then we can merge consolidation/annotated-command#303 and consolidation/output-formatters#108 and make releases.

Feel fee to comment on those PRs if you have any comments on naming things, or any other detail.

@greg-1-anderson greg-1-anderson requested a review from weitzman as a code owner June 8, 2023 17:58
use Attribute;

#[Attribute(Attribute::TARGET_METHOD)]
class TableEmptyMessage extends \Consolidation\AnnotatedCommand\Attributes\TableEmptyMessage

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems really unfortunate that we need to duplicate all of the attributes in the \Consolidation\AnnotatedCommand\Attributes namespace here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've accepted it in favor of having one namespace to autocomplete attribute names in an IDE. Custom code is welcome to use AC attributes directly as https://github.com/drush-ops/drush/blob/12.x/tests/fixtures/lib/Drush/Commands/ExampleAttributesDrushCommands.php#L80-L95 does.

])]
#[CLI\DefaultTableFields(fields: ['package', 'display_name', 'status', 'version'])]
#[CLI\FilterDefaultField(field: 'display_name')]
#[CLI\TableEmptyMessage(message: 'There are no items to list')]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run drush pm:list --filter=package=Core to see a list of core modules; run drush pm:list --filter=package=Foo to see the empty message.

@greg-1-anderson greg-1-anderson changed the title POC only: TableEmptyMessage attribute TableEmptyMessage attribute Jun 8, 2023

@weitzman weitzman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

use Attribute;

#[Attribute(Attribute::TARGET_METHOD)]
class TableEmptyMessage extends \Consolidation\AnnotatedCommand\Attributes\TableEmptyMessage

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've accepted it in favor of having one namespace to autocomplete attribute names in an IDE. Custom code is welcome to use AC attributes directly as https://github.com/drush-ops/drush/blob/12.x/tests/fixtures/lib/Drush/Commands/ExampleAttributesDrushCommands.php#L80-L95 does.

@weitzman

weitzman commented Aug 2, 2024

Copy link
Copy Markdown
Member

Looks like consolidation/annotated-command#303 needs to get merged still @greg-1-anderson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants