Skip to content

Conversation

cmcgee1024
Copy link
Member

@cmcgee1024 cmcgee1024 commented Oct 2, 2025

One of the benefits of traits comes from their declarative nature with a
description that helps to explain their purpose. Users should be able to
discover, and understand them so that they can enable them for the
current package, and also dependencies too so that they can enable them
through the package dependencies.

Add a new show-traits package subcommand that defaults to listing
the traits for the current package, and optionally for other packages
with an option.

swift package show-traits [--package-id=<packageId>]

Add a format option to set either a text, or JSON output format.

@cmcgee1024
Copy link
Member Author

@swift-ci please test

@cmcgee1024
Copy link
Member Author

@swift-ci please test

@cmcgee1024
Copy link
Member Author

@swift-ci please test

@cmcgee1024
Copy link
Member Author

@swifti-ci test Windows

@cmcgee1024
Copy link
Member Author

@swift-ci test Windows

Copy link
Contributor

@bripeticca bripeticca left a comment

Choose a reason for hiding this comment

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

Could we also add some tests for this command? :) otherwise LGTM!

@@ -0,0 +1,303 @@
# swift package show-traits
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: thank you for adding the docs for this command! :D

@cmcgee1024
Copy link
Member Author

Could we also add some tests for this command? :) otherwise LGTM!

I was thinking about the testing of this. My feeling is that either this would be yet another E2E test, which we have far too many, or it's just testing the package graph API's that it calls, which I think is already covered.

@cmcgee1024
Copy link
Member Author

@swift-ci please test

@cmcgee1024
Copy link
Member Author

@swift-ci test Windows

@cmcgee1024
Copy link
Member Author

@swift-ci test macOS

1 similar comment
@cmcgee1024
Copy link
Member Author

@swift-ci test macOS

@cmcgee1024
Copy link
Member Author

@swift-ci test Linux

2 similar comments
@cmcgee1024
Copy link
Member Author

@swift-ci test Linux

@cmcgee1024
Copy link
Member Author

@swift-ci test Linux

Copy link
Contributor

@bkhouri bkhouri left a comment

Choose a reason for hiding this comment

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

This is a great sub-command. It would be ideal is we can write some tests lower in the pyramid. Maybe tests that:

  • ensure the JSON generation returns the expected value
  • ensure the text/flatlist generation returns the expected output
  • The correct "traits" option is returned given the --package-id argument is set or not
  • 1 end-to-end test that ensure the overall workflow works as expected.

@cmcgee1024 cmcgee1024 requested a review from bkhouri October 6, 2025 19:13
@cmcgee1024
Copy link
Member Author

@swift-ci please test

@cmcgee1024
Copy link
Member Author

@swift-ci test Windows

1 similar comment
@cmcgee1024
Copy link
Member Author

@swift-ci test Windows

@cmcgee1024 cmcgee1024 requested a review from bripeticca October 7, 2025 18:52
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.

3 participants