From fab5a6d2b470733218240bb008ee4de46535e979 Mon Sep 17 00:00:00 2001 From: Oren Novotny Date: Thu, 31 Oct 2019 15:39:43 -0400 Subject: [PATCH 1/3] Use output name for submitted --- src/SignClient/SignCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SignClient/SignCommand.cs b/src/SignClient/SignCommand.cs index 98b40b39..7f400425 100644 --- a/src/SignClient/SignCommand.cs +++ b/src/SignClient/SignCommand.cs @@ -226,7 +226,7 @@ CommandOption maxConcurrency using var fs = new FileStream(output.FullName, FileMode.Create); str.CopyTo(fs); - signCommandLineApplication.Out.WriteLine($"Successfully signed '{input.FullName}'"); + signCommandLineApplication.Out.WriteLine($"Successfully signed '{output.FullName}'"); }); From 3f34088a6a4cebe39672f5f9e6ac3a9c4aa55c99 Mon Sep 17 00:00:00 2001 From: Oren Novotny Date: Thu, 31 Oct 2019 15:41:02 -0400 Subject: [PATCH 2/3] Add duration onto signed output --- src/SignClient/SignCommand.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SignClient/SignCommand.cs b/src/SignClient/SignCommand.cs index 7f400425..85db1834 100644 --- a/src/SignClient/SignCommand.cs +++ b/src/SignClient/SignCommand.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Net; @@ -169,6 +170,8 @@ CommandOption maxConcurrency { FileInfo output; + var sw = Stopwatch.StartNew(); + // Special case if there's only one input file and the output has a value, treat it as a file if(inputFiles.Count == 1 && outputFile.HasValue()) { @@ -226,7 +229,7 @@ CommandOption maxConcurrency using var fs = new FileStream(output.FullName, FileMode.Create); str.CopyTo(fs); - signCommandLineApplication.Out.WriteLine($"Successfully signed '{output.FullName}'"); + signCommandLineApplication.Out.WriteLine($"Successfully signed '{output.FullName}' in {sw.ElapsedMilliseconds} ms"); }); From dfc13460b803fce552741e3f4d1cee5c2dda88a3 Mon Sep 17 00:00:00 2001 From: Oren Novotny Date: Thu, 31 Oct 2019 15:55:19 -0400 Subject: [PATCH 3/3] enable use of a directory output for single inputs --- src/SignClient/SignCommand.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/SignClient/SignCommand.cs b/src/SignClient/SignCommand.cs index 85db1834..705459a9 100644 --- a/src/SignClient/SignCommand.cs +++ b/src/SignClient/SignCommand.cs @@ -91,7 +91,9 @@ CommandOption maxConcurrency List inputFiles; // If we're going to glob, we can't be fully rooted currently (fix me later) - if(inputFile.Value().Contains('*')) + var isGlob = inputFile.Value().Contains('*'); + + if (isGlob) { if(Path.IsPathRooted(inputFile.Value())) { @@ -174,12 +176,21 @@ CommandOption maxConcurrency // Special case if there's only one input file and the output has a value, treat it as a file if(inputFiles.Count == 1 && outputFile.HasValue()) - { - output = new FileInfo(ExpandFilePath(outputFile.Value())); + { + // See if it has a file extension and if not, treat as a directory and use the input file name + var outFileValue = outputFile.Value(); + if(Path.HasExtension(outFileValue)) + { + output = new FileInfo(ExpandFilePath(outputFile.Value())); + } + else + { + output = new FileInfo(Path.Combine(ExpandFilePath(outFileValue), inputFiles[0].Name)); + } } else { - // if the output is speciied, treat it as a directory, if not, overwrite the current file + // if the output is specified, treat it as a directory, if not, overwrite the current file if(!outputFile.HasValue()) { output = new FileInfo(input.FullName);