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

TableEmptyMessage attribute #5641

Open
wants to merge 1 commit into
base: 12.x
Choose a base branch
from
Open

Conversation

greg-1-anderson
Copy link
Member

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

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
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
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.

@@ -235,6 +235,7 @@ public function validateUninstall(CommandData $commandData): void
])]
#[CLI\DefaultTableFields(fields: ['package', 'display_name', 'status', 'version'])]
#[CLI\FilterDefaultField(field: 'display_name')]
#[CLI\TableEmptyMessage(message: 'There are no items to list')]
Copy link
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
Copy link
Member

@weitzman weitzman left a comment

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
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
Copy link
Member

weitzman commented Aug 2, 2024

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