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

Idea: --only / --include flag? #219

Open
danburzo opened this issue Aug 30, 2019 · 3 comments · May be fixed by #353
Open

Idea: --only / --include flag? #219

danburzo opened this issue Aug 30, 2019 · 3 comments · May be fixed by #353
Labels
viz visualization enhancement, graphviz

Comments

@danburzo
Copy link

I have just discovered Madge and it's just superb work!

It would be interesting for me, as I work on a Git branch, to understand how the files I've created relate to each other:

git diff --name-only --diff-filter=A origin/master...HEAD | grep -E '\.js$' | xargs madge

This command takes the added files as entry points, but shows their entire dependency graph. It would be great to limit it to the files I've sent as entry points.

If I understand correctly, the exclude option accepts a RegExp and I don't think I can use it.

Would an --only option make sense? It would limit the set of consider files to the original input. Or, if that's too specific, maybe an --include option (that you can use multiple time in a command), to supplement --exclude?

@danburzo danburzo changed the title Idea: --only flag? Idea: --only / --include flag? Aug 30, 2019
@danburzo
Copy link
Author

Added support for the --include flag in the PR above. It's not as straightforward to use with xargs as the --only shortcut, but here's the glorious final script that does what I intended :)

FILES=$(git diff --name-only --diff-filter=AM origin/master...HEAD); \
FLAGS=$(echo $FILES | sed 's/\(.*\)/--include "\1"/g'); \
echo $FLAGS $FILES | xargs -t madge

@villesau
Copy link

@pahen any chance taking this in? In non-trivial apps it's almost crucial to be able to limit the scope of the graph.

@PabloLION PabloLION added the viz visualization enhancement, graphviz label Jan 29, 2023
@PabloLION
Copy link
Collaborator

I temporarily categorize this as visualization filtering.
But for performance, maybe we don't need to generate the whole tree, which I don't think is the priority for now.

@danburzo danburzo linked a pull request Jan 30, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
viz visualization enhancement, graphviz
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants