Skip to content

Commit 0d41fd1

Browse files
committed
Added NuGet Pkg generation for the CommandLine project
1 parent 8bbc770 commit 0d41fd1

File tree

4 files changed

+60
-188
lines changed

4 files changed

+60
-188
lines changed

src/Ubiquity.NET.CommandLine/ArgsParsing.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,21 @@ out int exitCode
185185
return true;
186186
}
187187

188-
/// <inheritdoc cref="TryParse{T}(string[], CmdLineSettings?, IDiagnosticReporter, out T)"/>
188+
/// <inheritdoc cref="TryParse{T}(string[], CmdLineSettings?, IDiagnosticReporter, out T, out int)"/>
189189
public static bool TryParse<T>( string[] args, CmdLineSettings settings, [MaybeNullWhen( false )] out T boundValue, out int exitCode )
190190
where T : IRootCommand<T>
191191
{
192192
return TryParse<T>( args, settings, new ConsoleReporter( MsgLevel.Information ), out boundValue, out exitCode );
193193
}
194194

195-
/// <inheritdoc cref="TryParse{T}(string[], CmdLineSettings?, IDiagnosticReporter, out T)"/>
195+
/// <inheritdoc cref="TryParse{T}(string[], CmdLineSettings?, IDiagnosticReporter, out T, out int)"/>
196196
public static bool TryParse<T>( string[] args, [MaybeNullWhen( false )] out T boundValue, out int exitCode )
197197
where T : IRootCommand<T>
198198
{
199199
return TryParse<T>( args, settings: null, new ConsoleReporter( MsgLevel.Information ), out boundValue, out exitCode );
200200
}
201201

202-
/// <inheritdoc cref="TryParse{T}(string[], CmdLineSettings?, IDiagnosticReporter, out T)"/>
202+
/// <inheritdoc cref="TryParse{T}(string[], CmdLineSettings?, IDiagnosticReporter, out T, out int)"/>
203203
public static bool TryParse<T>( string[] args, IDiagnosticReporter diagnosticReporter, [MaybeNullWhen( false )] out T boundValue, out int exitCode )
204204
where T : IRootCommand<T>
205205
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Ubiquity.NET.CommandLine
2+
Command line parsing support extending System.CommandLine to better isolate the parsing
3+
from the app specific validation and execution.
4+
5+
``` C#
6+
var reporter = new ColoredConsoleReporter(MsgLevel.Information);
7+
if(!ArgsParsing.TryParse<Options>( args, reporter, out Options? options, out int exitCode ))
8+
{
9+
return exitCode;
10+
}
11+
12+
// ...
13+
14+
// Options is a class that has properties for all parsed commands, arguments and options
15+
// Allowing for validation of them all in context (including each other)
16+
// App can then dispatch behavior based on the commands/options etc... as needed.
17+
// NO ASSUMPTION IS MADE ABOUT THE USE OF COMMANDS NOR THE BEHAVIOR OF THEM. The app
18+
// is entirely in control of how they are used.
19+
20+
```
Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5-
<Nullable>enable</Nullable>
6-
<!--Until C#14 and the "field" and "extensions" keywords are available use the preview language -->
7-
<LangVersion>preview</LangVersion>
8-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<!--Until C#14 and the "field" and "extensions" keywords are available use the preview language -->
7+
<LangVersion>preview</LangVersion>
8+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
99

10-
<ItemGroup>
11-
<PackageReference Include="PolySharp">
12-
<PrivateAssets>all</PrivateAssets>
13-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14-
</PackageReference>
15-
<PackageReference Include="System.CommandLine" />
16-
</ItemGroup>
10+
<!--NuGet packaging support -->
11+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
12+
<MinClientVersion>4.9.0</MinClientVersion>
13+
<Authors>.NET Foundation,Ubiquity.NET</Authors>
14+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
15+
<Description>General use Support for Command line parsing based on System.CommandLine</Description>
16+
<PackageTags>Extensions,.NET,Ubiquity.NET, Console</PackageTags>
17+
<PackageReadmeFile>PackageReadMe.md</PackageReadmeFile>
18+
<PackageProjectUrl>https://github.com/UbiquityDotNET/Llvm.NET</PackageProjectUrl>
19+
<RepositoryUrl>https://github.com/UbiquityDotNET/Llvm.NET.git</RepositoryUrl>
20+
<RepositoryType>git</RepositoryType>
21+
<PackageLicenseExpression>Apache-2.0 WITH LLVM-exception</PackageLicenseExpression>
22+
<IncludeSymbols>true</IncludeSymbols>
23+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
24+
</PropertyGroup>
1725

18-
<ItemGroup>
19-
<ProjectReference Include="..\Ubiquity.NET.Extensions\Ubiquity.NET.Extensions.csproj" />
20-
<ProjectReference Include="..\Ubiquity.NET.TextUX\Ubiquity.NET.TextUX.csproj" />
21-
</ItemGroup>
26+
<ItemGroup>
27+
<None Include="PackageReadMe.md" Pack="true" PackagePath="\" />
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<PackageReference Include="PolySharp">
32+
<PrivateAssets>all</PrivateAssets>
33+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
34+
</PackageReference>
35+
<PackageReference Include="System.CommandLine" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<ProjectReference Include="..\Ubiquity.NET.Extensions\Ubiquity.NET.Extensions.csproj" />
40+
<ProjectReference Include="..\Ubiquity.NET.TextUX\Ubiquity.NET.TextUX.csproj" />
41+
</ItemGroup>
2242

2343
</Project>

src/Ubiquity.NET.Extensions/PolyFillExtensions.cs

Lines changed: 0 additions & 168 deletions
This file was deleted.

0 commit comments

Comments
 (0)