Skip to content

feat(cli): Add --exclude-relationships and relationship filtering #33

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

Merged
merged 5 commits into from
Aug 8, 2025

Conversation

tasuku43
Copy link
Owner

@tasuku43 tasuku43 commented Aug 8, 2025

This PR introduces relationship-level filtering and a clearer CLI for excluding edges at render time.

Closes #27

Summary

  • Add --exclude-relationships (CSV) to the CLI to hide specific relationship types: dependency, composition, inheritance, realization. Aliases supported (dep/comp/extends/implements).
  • Introduce Relationships collection to encapsulate relationship storage, sorting, and filtering.
  • Expand RenderOptions with explicit required flags and a RenderOptions::default() factory.
  • Wire filtering in ClassDiagram::render() via Relationships::filter(RenderOptions).
  • Update README and ARCHITECTURE to document the new option and flags.
  • Remove legacy flag --only-properties-deps and previous --exclude (no compatibility kept as requested).

Why

  • Make filtering behavior explicit and composable by relationship type.
  • Clarify CLI semantics by naming the target domain (relationships).

Details

  • Public API: RenderOptions now requires 4 boolean args; use RenderOptions::default() for defaults.
  • Renderer: ClassDiagram now holds Relationships instead of an array.
  • Behavior: Defaults remain unchanged; your output stays the same unless you pass an exclude list.

Examples

  • Hide dependencies and compositions:
    vendor/bin/mermaid-class-diagram generate --path src --exclude-relationships dependency,composition
  • Hide only dependencies:
    vendor/bin/mermaid-class-diagram generate --path src --exclude-relationships dependency

Testing

  • PHPUnit: all tests pass locally (37 tests, 64 assertions).

Notes

  • Future room: add complementary --include-relationships if desired for explicit whitelisting.

@tasuku43 tasuku43 merged commit b11d38b into main Aug 8, 2025
1 check passed
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.

Feature request: Add switch to include/exclude parameters and return types from the diagram
1 participant