Skip to content

Commit

Permalink
Merge pull request #140 from vcsjones/minor-improvements
Browse files Browse the repository at this point in the history
Bump package versions and display better help
  • Loading branch information
vcsjones authored Sep 13, 2021
2 parents a67eca5 + 87567a2 commit a4f1d84
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
name: Checkout
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.100'
dotnet-version: '3.1.412'
- run: dotnet test
2 changes: 1 addition & 1 deletion src/AzureSign.Core/AzureSign.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.18" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions src/AzureSignTool/AzureSignTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.2.0-preview.2" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.0.2" />
<PackageReference Include="Azure.Identity" Version="1.4.1" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.2.0" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.18" />
<PackageReference Include="RSAKeyVaultProvider" Version="2.1.1" />
</ItemGroup>

Expand Down
9 changes: 2 additions & 7 deletions src/AzureSignTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@ public static int Main(string[] args)
Console.Error.WriteLine("Azure Sign Tool is only supported on Windows.");
return E_PLATFORMNOTSUPPORTED;
}
var application = new CommandLineApplication<Program>();
var application = new CommandLineApplication<SignApplication>();
application.ValueParsers.Add(new HashAlgorithmNameValueParser());
application.ShowHint();
application.Command<SignCommand>("sign", config =>
{
config.Description = "Signs a file.";
config.Conventions.UseDefaultConventions();
});
application.Command(string.Empty, config => {
application.ShowHelp();
application.ShowHint();
});
application.Conventions.UseDefaultConventions();
application.UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.StopParsingAndCollect;
return application.Execute(args);
}
Expand Down
20 changes: 20 additions & 0 deletions src/AzureSignTool/SignApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using McMaster.Extensions.CommandLineUtils;

namespace AzureSignTool
{
internal sealed class SignApplication
{
private readonly CommandLineApplication _current;

public SignApplication(CommandLineApplication current)
{
_current = current;
}

public int OnExecute()
{
_current.ShowHelp();
return 1;
}
}
}
4 changes: 2 additions & 2 deletions test/AzureSignTool.Tests/HelpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void BlankInputShouldShowHelpOutput()
});

Assert.Contains("Usage:", StdOut);
Assert.Equal(0, ExitCode);
Assert.Equal(1, ExitCode);
}

[Fact]
Expand All @@ -26,7 +26,7 @@ public void BlankInputForSignCommandShouldShowHelpOutput()
return Program.Main(new string[] { "sign" });
});

Assert.Contains("Usage:", StdOut);
Assert.Contains("--help", StdOut);
Assert.NotEqual(0, ExitCode);
}

Expand Down

0 comments on commit a4f1d84

Please sign in to comment.