Skip to content

Add -output flag to write the graph to a file#58

Open
qwerty8811 wants to merge 1 commit intokisielk:masterfrom
qwerty8811:add-output-flag
Open

Add -output flag to write the graph to a file#58
qwerty8811 wants to merge 1 commit intokisielk:masterfrom
qwerty8811:add-output-flag

Conversation

@qwerty8811
Copy link
Copy Markdown

@qwerty8811 qwerty8811 commented Mar 22, 2026

Summary
Added an -output flag to write dependency graph output (DOT or Mermaid) to a file instead of stdout. Provides a documented graph → path option (visible in -help) without relying on shell redirects, and surfaces file I/O errors directly from the tool.

What changed

  • New flag: -output - file path for graph output (defaults to stdout if empty).
  • Refactor: graphvizPrinter and mermaidPrinter now accept an io.Writer and write via fmt.Fprint instead of stdout.

Usage

godepgraph -output deps.dot ./your/package
godepgraph -format mermaid -output deps.mmd ./your/package

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.

1 participant