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

Add options -format,-file for PNG/SVG file output #39

Merged
merged 5 commits into from
Jan 14, 2019

Conversation

Russtopia
Copy link
Contributor

Addition of -output, -svg, -png options to run go-callvis in a non-server mode to just output image files.
Useful for scripting eg., makefile targets to generate graphvis for modules non-interactively.

@Russtopia
Copy link
Contributor Author

Intended to address issue #36

main.go Outdated Show resolved Hide resolved
handler.go Outdated Show resolved Hide resolved
@ondrajz
Copy link
Owner

ondrajz commented Dec 15, 2018

Thank you for your contribution. Please fix the PR as mentioned in comments.

@ondrajz
Copy link
Owner

ondrajz commented Dec 16, 2018

@Russtopia It would be really great if you could also update few examples that show command usage with parameters, because they don't currently show something that would work with latest version.

@Russtopia
Copy link
Contributor Author

@Russtopia It would be really great if you could also update few examples that show command usage with parameters, because they don't currently show something that would work with latest version.

Sure, I should have done that with the original patch.

@Russtopia Russtopia changed the title Added -output, -svg, -png options for non-server mode Add options -format,-file for PNG/SVG file output Dec 18, 2018
@Russtopia
Copy link
Contributor Author

@Russtopia It would be really great if you could also update few examples that show command usage with parameters, because they don't currently show something that would work with latest version.

Newest PR updates examples, but I had to guess at the last example -- I'm unfamiliar with 'exo-open' but from the context it appears to take the SVG output and convert to JPG?

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
dot.go Outdated Show resolved Hide resolved
Copy link
Owner

@ondrajz ondrajz left a comment

Choose a reason for hiding this comment

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

I think the output format should not be checked for validity and we should let the dot program itself fail and report unsupported format error. We don't want to limit the output formats to only two options if there are many more formats supported by dot.

@Russtopia
Copy link
Contributor Author

New version pushed. Implements the changes suggested:

  • output format no longer limited to png/svg; outputFormat passed to 'dot' -T arg allowing any supported format
  • server mode is activated by omitting -file arg, seems more sensible
  • Tested server mode with and without -skipbrowser, specifying -format jpg, svg etc. and with no -format specified (defaults to svg)
  • Tested -file mode with -format [png, svg, gif, jpg] OK - other invalid values cause dot to return error 1 (could be improved?) - go-callvis will exit with status 1 in this case

} else {
img = fmt.Sprintf("%s.%s", outfname, format)
}
cmd := exec.Command(dotExe, fmt.Sprintf("-T%s", format), "-o", img)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

format arg now passed directly to dotExe

@ondrajz ondrajz merged commit 73ead25 into ondrajz:master Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants