Skip to content

Commit f3a939a

Browse files
CopilotAArnott
andauthored
Fix inconsistent CLI output format for GitCommitDate (#1246)
* Initial plan * Fix inconsistent CLI output format for GitCommitDate Co-authored-by: AArnott <[email protected]> * touch-ups --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: AArnott <[email protected]> Co-authored-by: Andrew Arnott <[email protected]>
1 parent 6c7bb08 commit f3a939a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/nbgv/Program.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.CommandLine;
77
using System.CommandLine.Invocation;
88
using System.CommandLine.Parsing;
9+
using System.Globalization;
910
using System.IO;
1011
using System.Linq;
1112
using System.Reflection;
@@ -664,7 +665,13 @@ private static Task<int> OnGetVersionCommand(string project, string[] metadata,
664665
return Task.FromResult((int)ExitCodes.BadVariable);
665666
}
666667

667-
Console.WriteLine(property.GetValue(oracle));
668+
object propertyValue = property.GetValue(oracle);
669+
string output = propertyValue switch
670+
{
671+
DateTimeOffset dateTimeOffset => dateTimeOffset.ToString("yyyy-MM-ddTHH:mm:sszzz", CultureInfo.InvariantCulture),
672+
_ => propertyValue?.ToString() ?? string.Empty,
673+
};
674+
Console.WriteLine(output);
668675
}
669676

670677
return Task.FromResult((int)ExitCodes.OK);

0 commit comments

Comments
 (0)