Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/cd-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ jobs:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore src/System.CommandLine.Minimal.sln
run: dotnet restore src/MinimalCli.sln
# build solution here instead of project
- name: Build Minimal CommandLine
run: dotnet build src/System.CommandLine.Minimal.sln -c Release --no-restore
run: dotnet build src/MinimalCli.sln -c Release --no-restore

# packs all nuget packages at once
- name: Pack MinimalCommandLine Nuget Alpha
run: dotnet pack src/System.CommandLine.Minimal/System.CommandLine.Minimal.csproj -p:PackageVersion=0.5.0.${{github.run_number}}-alpha -o ./packages
run: dotnet pack src/MinimalCli/MinimalCli.csproj -p:PackageVersion=0.5.0.${{github.run_number}}-alpha -o ./packages
- name: Pack MinimalCommandLine Nuget
run: dotnet pack src/System.CommandLine.Minimal/System.CommandLine.Minimal.csproj -p:PackageVersion=0.5.0.${{github.run_number}} -o ./packages
run: dotnet pack src/MinimalCli/MinimalCli.csproj -p:PackageVersion=0.5.0.${{github.run_number}} -o ./packages

- name: Publish MinimalCommandLine Artifacts
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore src/System.CommandLine.Minimal.sln
run: dotnet restore src/MinimalCli.sln

- name: Build Minimal CommandLine
run: dotnet build src/System.CommandLine.Minimal.sln -c Release --no-restore
run: dotnet build src/MinimalCli.sln -c Release --no-restore

- name: Build HelloWorld Demo
run: dotnet build src/HelloWorld/HelloWorld.csproj -c Release --no-restore
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
First, create a new console application, then create a class to house the logic for your command:

```csharp
using System.CommandLine.Minimal;
using MinimalCli;

public class HelloWorld
{
Expand All @@ -33,7 +33,7 @@ public class HelloWorld
Next, setup your Console App's `Program.cs` file:

```csharp
using System.CommandLine.Minimal;
using MinimalCli;

var builder = new MinimalCommandLineBuilder(args)

Expand Down Expand Up @@ -70,7 +70,7 @@ Add a reference to the nuget package `MinimalCommandLine`.
A simple command with an Argument and an Option:

```csharp
using System.CommandLine.Minimal;
using MinimalCli;

public class MyCommand
{
Expand Down Expand Up @@ -101,7 +101,7 @@ a `System.CommandLine.Option` is created when the parameter is optional.
A simple command with two Arguments: a required Argument and an optional Argument:

```csharp
using System.CommandLine.Minimal;
using MinimalCli;

public class MyCommand
{
Expand All @@ -123,7 +123,7 @@ registering a command, the source generator creates an extension method that you
the descriptions, aliases, default values, and any other System.CommandLine functionality.

```csharp
using System.CommandLine.Minimal;
using MinimalCli;

// after creating a 'greet' command that accepts a 'name' argument:

Expand Down
4 changes: 2 additions & 2 deletions src/DemoApp/DemoApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</ItemGroup>-->

<ItemGroup>
<ProjectReference Include="..\System.CommandLine.Minimal.Core\System.CommandLine.Minimal.Core.csproj" />
<ProjectReference Include="..\System.CommandLine.Minimal.SourceGenerator\System.CommandLine.Minimal.SourceGenerator.csproj">
<ProjectReference Include="..\MinimalCli.Core\MinimalCli.Core.csproj" />
<ProjectReference Include="..\MinimalCli.SourceGenerator\MinimalCli.SourceGenerator.csproj">
<OutputItemType>Analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
Expand Down
2 changes: 1 addition & 1 deletion src/DemoApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using DemoApp.Services;
using Microsoft.Extensions.DependencyInjection;
using System.CommandLine;
using System.CommandLine.Minimal;
using MinimalCli;

MinimalCommandLineBuilder builder = new(args);

Expand Down
2 changes: 1 addition & 1 deletion src/DemoApp/Services/IntermediateCaGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.CommandLine.Minimal;
using MinimalCli;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

Expand Down
2 changes: 1 addition & 1 deletion src/DemoApp/Services/RootCaGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.CommandLine.Minimal;
using MinimalCli;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

Expand Down
2 changes: 1 addition & 1 deletion src/DemoApp/Services/SSLCertificateGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.CommandLine.Minimal;
using MinimalCli;
using System.Net;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
Expand Down
4 changes: 2 additions & 2 deletions src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</ItemGroup>-->

<ItemGroup>
<ProjectReference Include="..\System.CommandLine.Minimal.Core\System.CommandLine.Minimal.Core.csproj" />
<ProjectReference Include="..\System.CommandLine.Minimal.SourceGenerator\System.CommandLine.Minimal.SourceGenerator.csproj">
<ProjectReference Include="..\MinimalCli.Core\MinimalCli.Core.csproj" />
<ProjectReference Include="..\MinimalCli.SourceGenerator\MinimalCli.SourceGenerator.csproj">
<OutputItemType>Analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
Expand Down
3 changes: 1 addition & 2 deletions src/HelloWorld/HelloWorldClass.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.CommandLine;
using System.CommandLine.Minimal;
using MinimalCli;

namespace Hello;

Expand Down
2 changes: 1 addition & 1 deletion src/HelloWorld/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.CommandLine.Minimal;
using MinimalCli;

MinimalCommandLineBuilder builder = new(args);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace System.CommandLine.Minimal;
using System;

namespace MinimalCli;

[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class ArgumentAttribute : Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace System.CommandLine.Minimal;
using System.CommandLine;

namespace MinimalCli;

public class ArgumentBuilder<T>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace System.CommandLine.Minimal.Bindings;
namespace MinimalCli.Bindings;

public record ArgumentBinding(string ParameterName, Type ParameterType, Argument Argument)
: ParameterBinding(ParameterName, ParameterType)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace System.CommandLine.Minimal.Bindings;
namespace MinimalCli.Bindings;

public abstract class CommandBinding
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace System.CommandLine.Minimal.Bindings;
namespace MinimalCli.Bindings;

public class CommandBindingFactory
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Threading;
using System;
using System.CommandLine;
using System.Threading;
using System.Threading.Tasks;

namespace System.CommandLine.Minimal.Bindings;
namespace MinimalCli.Bindings;

public abstract class CommandOptions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace System.CommandLine.Minimal.Bindings;
using System;

namespace MinimalCli.Bindings;

public record DependencyInjectionBinding(string ParameterName, Type ParameterType)
: ParameterBinding(ParameterName, ParameterType)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace System.CommandLine.Minimal.Bindings;
namespace MinimalCli.Bindings;

public record OptionBinding(string ParameterName, Type ParameterType, Option Option)
: ParameterBinding(ParameterName, ParameterType)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
namespace System.CommandLine.Minimal.Bindings;
using System;

namespace MinimalCli.Bindings;

public abstract record ParameterBinding(string ParameterName, Type ParameterType);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;

namespace System.CommandLine.Minimal;
namespace MinimalCli;

public class CommandBuilder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;

namespace System.CommandLine.Minimal;
namespace MinimalCli;

public class CommandBuilder<THandler>
where THandler : notnull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace System.CommandLine.Minimal;
namespace MinimalCli;

public enum CommandExecutionMode
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Microsoft.Extensions.Hosting;
using System.CommandLine.Minimal.Bindings;
using MinimalCli.Bindings;
using System.CommandLine.Parsing;
using System.Threading.Tasks;

namespace System.CommandLine.Minimal;
namespace MinimalCli;

internal class CommandExecutorCli : ICommandExecutor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Microsoft.Extensions.Hosting;
using System.CommandLine.Parsing;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;

namespace System.CommandLine.Minimal;
namespace MinimalCli;

internal class CommandExecutorShell : ICommandExecutor
{
Expand All @@ -24,7 +25,7 @@ public void SetExitCommands(string[] exitCommands)
this.exitCommands = exitCommands;
}

[Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers",
[SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers",
Justification = "This is not code that runs during analysis")]
public async Task<int> ExecuteAsync(RootCommand rootCommand, string[] args)
{
Expand Down Expand Up @@ -53,7 +54,7 @@ public async Task<int> ExecuteAsync(RootCommand rootCommand, string[] args)

return 0;
}
[Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers",
[SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers",
Justification = "This is not code that runs during analysis")]
public int Execute(RootCommand rootCommand, string[] args)
{
Expand Down Expand Up @@ -83,7 +84,7 @@ public int Execute(RootCommand rootCommand, string[] args)
return 0;
}

[Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers",
[System.Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers",
Justification = "This is not code that runs during analysis")]
private static bool GetInput(RootCommand rootCommand, string prompt, string[] exitCommands, out ParseResult? result)
{
Expand All @@ -103,7 +104,7 @@ private static bool GetInput(RootCommand rootCommand, string prompt, string[] ex
return true;
}

[Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers",
[SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers",
Justification = "This is not code that runs during analysis")]
private static void ShowParserErrors(ParseResult result)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace System.CommandLine.Minimal;
namespace MinimalCli;

[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class FromServicesAttribute : Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace System.CommandLine.Minimal;
namespace MinimalCli;

[AttributeUsage(AttributeTargets.Method)]
public sealed class HandlerAttribute : Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;

namespace System.CommandLine.Minimal;
namespace MinimalCli;

internal interface ICommandExecutor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<RepositoryUrl>https://github.com/dotnetKyle/MinimalCommandLine</RepositoryUrl>
<PackageTags>Command; Line</PackageTags>
<DebugType>embedded</DebugType>
<RootNamespace>System.CommandLine.Minimal</RootNamespace>
<RootNamespace>MinimalCli</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Collections.Generic;
using System.CommandLine.Minimal.Bindings;
using MinimalCli.Bindings;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace System.CommandLine.Minimal;
namespace MinimalCli;

public class MinimalCommandLineApp : IHostedService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.CommandLine.Minimal.Bindings;
using MinimalCli.Bindings;

namespace System.CommandLine.Minimal;
namespace MinimalCli;

public class MinimalCommandLineBuilder : IHostApplicationBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace System.CommandLine.Minimal;
namespace MinimalCli;

[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class OptionAttribute : Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace System.CommandLine.Minimal;
namespace MinimalCli;

public class OptionBuilder<T>
{
Expand Down
3 changes: 3 additions & 0 deletions src/MinimalCli.Core/_Imports.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global using System;
global using System.Collections.Generic;
global using System.CommandLine;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Linq;
using System.Text;

namespace System.CommandLine.Minimal.SourceGeneration;
namespace MinimalCli.SourceGeneration;

internal static class CommandOptionsWriter
{
Expand All @@ -19,11 +19,11 @@ internal static class CommandOptionsWriter
using System;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.Minimal.Bindings;
using MinimalCli.Bindings;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace System.CommandLine.Minimal
namespace MinimalCli
{
"""
);
Expand Down Expand Up @@ -215,7 +215,7 @@ public static class Configure{{binder.CommandNameTitleCase}}BuilderExtensions

}

// end namespace System.CommandLine.Minimal
// end namespace MinimalCli
sb.AppendLine("}");

return sb.ToString();
Expand Down
Loading