Skip to content

Commit

Permalink
fix command line argument issue for json arguments
Browse files Browse the repository at this point in the history
add .netcore2.1 support
  • Loading branch information
Blind-Striker committed Apr 30, 2020
1 parent 899a3cf commit c22c547
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 4 deletions.
34 changes: 34 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/LocalStack.AwsLocal/bin/Debug/netcoreapp3.1/LocalStack.AwsLocal.dll",
"args": [
"sns",
"publish",
"--topic-arn",
"arn:aws:sns:eu-central-1:000000000000:sentinel-live-jobupdate",
"--message",
" '{ \"JobId\": 5, \"JobStatusId\" : 9, \"Environment\": \"Development\" }'"
],
"cwd": "${workspaceFolder}/src/LocalStack.AwsLocal",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
42 changes: 42 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/LocalStack.AwsLocal/LocalStack.AwsLocal.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/LocalStack.AwsLocal/LocalStack.AwsLocal.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/src/LocalStack.AwsLocal/LocalStack.AwsLocal.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
6 changes: 6 additions & 0 deletions build/azure-pipelines.artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ steps:
version: "3.1.x"
packageType: sdk

- task: UseDotNet@2
displayName: ".NET Core 2.1.x"
inputs:
version: "2.1.x"
packageType: sdk

- task: Bash@3
displayName: "Compile & Tests"
inputs:
Expand Down
6 changes: 6 additions & 0 deletions build/azure-pipelines.macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ steps:
version: "3.1.x"
packageType: sdk

- task: UseDotNet@2
displayName: ".NET Core 2.1.x"
inputs:
version: "2.1.x"
packageType: sdk

- task: Bash@3
displayName: "Compile & Tests"
inputs:
Expand Down
6 changes: 6 additions & 0 deletions build/azure-pipelines.ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ steps:
version: "3.1.x"
packageType: sdk

- task: UseDotNet@2
displayName: ".NET Core 2.1.x"
inputs:
version: "2.1.x"
packageType: sdk

- task: Bash@3
displayName: "Compile & Tests"
inputs:
Expand Down
12 changes: 10 additions & 2 deletions src/LocalStack.AwsLocal/LocalStack.AwsLocal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssemblyName>LocalStack.AwsLocal</AssemblyName>
<RootNamespace>LocalStack.AwsLocal</RootNamespace>
Expand All @@ -29,7 +29,7 @@
<None Include="LICENSE.txt" Pack="true" PackagePath="">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="../../assets/localstack-dotnet-square.png" Pack="true" PackagePath=""/>
<None Include="../../assets/localstack-dotnet-square.png" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
Expand All @@ -46,4 +46,12 @@

<None Include="..\..\depedencies\README.md" Link="Depedencies\README.md" />
</ItemGroup>

<ItemGroup>
<Folder Include="Depedencies\CommandLineApi\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20214.1" />
</ItemGroup>
</Project>
10 changes: 9 additions & 1 deletion src/LocalStack.AwsLocal/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using LocalStack.Client;
using System;
using System.CommandLine;
using System.CommandLine.Parsing;
using System.Diagnostics;
using System.Linq;

namespace LocalStack.AwsLocal
{
Expand All @@ -9,10 +13,14 @@ internal static class Program

private static void Main(string[] args)
{
var rootCommand = new RootCommand();
ParseResult parseResult = rootCommand.Parse(args);
var parsedArgs = parseResult.Tokens.Select(token => token.Value).ToArray();

var processHelper = new ProcessHelper();
var config = new Config(LocalStackHost);

var commandDispatcher = new CommandDispatcher(processHelper, config, args);
var commandDispatcher = new CommandDispatcher(processHelper, config, parsedArgs);

commandDispatcher.Run();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1</TargetFrameworks>

<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<LangVersion>latest</LangVersion>
Expand Down

0 comments on commit c22c547

Please sign in to comment.