[doc_checker] Only generate a graph file when the option is set.
Test: verified that no file was generated by default, only with the flag.
Change-Id: If9773b1cc3413378acfa39b10bc7b85d4e8fac52
diff --git a/tools/doc_checker/bin/main.dart b/tools/doc_checker/bin/main.dart
index 540a1a2..877d685 100644
--- a/tools/doc_checker/bin/main.dart
+++ b/tools/doc_checker/bin/main.dart
@@ -81,7 +81,7 @@
..addOption(
_optionDotFile,
help: 'Path to the dotfile to generate',
- defaultsTo: 'graph.dot',
+ defaultsTo: '',
)
..addOption(
_optionGitProject,
@@ -191,7 +191,9 @@
..sort((Error a, Error b) => a.type.index - b.type.index)
..forEach(reportError);
- graph.export('fuchsia_docs', new File(options[_optionDotFile]).openWrite());
+ if (options[_optionDotFile].isNotEmpty) {
+ graph.export('fuchsia_docs', new File(options[_optionDotFile]).openWrite());
+ }
if (errors.isNotEmpty) {
print('Found ${errors.length} error(s).');