Skip to content

Commit

Permalink
fix: use dotnet 2.1 and logger
Browse files Browse the repository at this point in the history
  • Loading branch information
guitarrapc committed May 14, 2019
1 parent 0009be8 commit 3dbdc7f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
23 changes: 13 additions & 10 deletions src/base64urls/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ static async Task Main(string[] args) =>

public class Base64Batch : BatchBase
{
private readonly ILogger<BatchEngine> logger;
public Base64Batch(ILogger<BatchEngine> logger) => this.logger = logger;

[Command("encode", "encode input string to base64url")]
public void Encode([Option(0)]string input) => Context.Logger.LogInformation(Base64Url.Encode(input));
public void Encode([Option(0)]string input) => logger.LogInformation(Base64Url.Encode(input));

[Command("decode", "decode input base64url to string")]
public void Decode([Option(0)]string input) => Context.Logger.LogInformation(Base64Url.Decode(input));
public void Decode([Option(0)]string input) => logger.LogInformation(Base64Url.Decode(input));

[Command("escape", "escape base64 to base64url")]
public void Escape([Option(0)]string input) => Context.Logger.LogInformation(Base64Url.Escape(input));
public void Escape([Option(0)]string input) => logger.LogInformation(Base64Url.Escape(input));

[Command("unescape", "unescape base64url to base64")]
public void Unescape([Option(0)]string input) => Context.Logger.LogInformation(Base64Url.Unescape(input));
public void Unescape([Option(0)]string input) => logger.LogInformation(Base64Url.Unescape(input));

/// <summary>
/// Provide unix style command argument: -version --version -v + version command
Expand All @@ -37,7 +40,7 @@ public void Version()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
.InformationalVersion
.ToString();
Context.Logger.LogInformation($"base64urls v{version}");
logger.LogInformation($"base64urls v{version}");
}

/// <summary>
Expand All @@ -49,11 +52,11 @@ public void Version()
[Command(new[] { "help", "list", "-h", "-help", "--help" }, "show help")]
public void Help()
{
Context.Logger.LogInformation("Usage: base64urls [-version] [-help] [decode|encode|escape|unescape] [args]");
Context.Logger.LogInformation("E.g., run this: base64urls decode QyMgaXMgYXdlc29tZQ==");
Context.Logger.LogInformation("E.g., run this: base64urls encode \"C# is awesome.\"");
Context.Logger.LogInformation("E.g., run this: base64urls escape \"This+is/goingto+escape==\"");
Context.Logger.LogInformation("E.g., run this: base64urls unescape \"This-is_goingto-escape\"");
logger.LogInformation("Usage: base64urls [-version] [-help] [decode|encode|escape|unescape] [args]");
logger.LogInformation("E.g., run this: base64urls decode QyMgaXMgYXdlc29tZQ==");
logger.LogInformation("E.g., run this: base64urls encode \"C# is awesome.\"");
logger.LogInformation("E.g., run this: base64urls escape \"This+is/goingto+escape==\"");
logger.LogInformation("E.g., run this: base64urls unescape \"This-is_goingto-escape\"");
}
}
}
4 changes: 2 additions & 2 deletions src/base64urls/base64urls.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>latest</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

Expand Down
4 changes: 2 additions & 2 deletions tests/Base64UrlCore.Tests/Base64UrlCore.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/Base64UrlCoreTool.Tests/Base64UrlCoreTool.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion tests/Base64UrlCoreTool.Tests/TestStringLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System;

namespace Base64UrlCoreTool.Tests

{
public class TestStringLogger : ILogger<BatchEngine>
{
Expand Down

0 comments on commit 3dbdc7f

Please sign in to comment.