Skip to content
This repository was archived by the owner on Sep 20, 2022. It is now read-only.

Commit d53d68f

Browse files
author
Jake Ginnivan
committed
Warn if no output file is specified rather than error, and handle that arg not being passed
1 parent 1cf3f61 commit d53d68f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/GitReleaseNotes/ArgumentVerifier.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ public static bool VerifyArguments(GitReleaseNotesArguments arguments)
1313
return false;
1414
}
1515
}
16-
if ((string.IsNullOrEmpty(arguments.OutputFile) || !arguments.OutputFile.EndsWith(".md")) && !arguments.Publish)
16+
if (string.IsNullOrEmpty(arguments.OutputFile) && !arguments.Publish)
1717
{
18-
Console.WriteLine("Specify an output file (*.md) [/OutputFile ...]");
19-
{
20-
return false;
21-
}
18+
Console.WriteLine("WARN: No Output file specified (*.md) [/OutputFile ...]");
19+
}
20+
if (!string.IsNullOrEmpty(arguments.OutputFile) && !arguments.OutputFile.EndsWith(".md"))
21+
{
22+
Console.WriteLine("WARN: Output file should have a .md extension [/OutputFile ...]");
23+
arguments.OutputFile = null;
2224
}
2325
return true;
2426
}

src/GitReleaseNotes/ReleaseFileWriter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public ReleaseFileWriter(IFileSystem fileSystem, string repositoryRoot)
1515

1616
public void OutputReleaseNotesFile(string releaseNotesOutput, GitReleaseNotesArguments arguments)
1717
{
18+
if (string.IsNullOrEmpty(arguments.OutputFile))
19+
return;
1820
var outputFile = Path.IsPathRooted(arguments.OutputFile) ? arguments.OutputFile : Path.Combine(_repositoryRoot, arguments.OutputFile);
1921
_fileSystem.WriteAllText(outputFile, releaseNotesOutput);
2022
}

0 commit comments

Comments
 (0)