Skip to content

Commit 6ce3f06

Browse files
committed
updated nuget package information. added simpler way of specifying validators when using the autobind approach.
1 parent 2146a43 commit 6ce3f06

File tree

12 files changed

+80
-30
lines changed

12 files changed

+80
-30
lines changed

AutofacCommandLine/AutofacCommandLine.csproj

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
<Nullable>enable</Nullable>
66
<AssemblyName>J4JSoftware.CommandLine.Autofac</AssemblyName>
77
<RootNamespace>J4JSoftware.CommandLine</RootNamespace>
8-
<Version>0.1.0.0</Version>
98
<Authors>Mark A. Olbert</Authors>
109
<Company>Jump for Joy Software</Company>
1110
<Product>J4JSoftware Command Line Processor</Product>
1211
<Description>Autofac support for J4JCommandLine</Description>
1312
<Copyright>© Mark A. Olbert all rights reserved</Copyright>
14-
<PackageDescription>Add on to J4JCommandLine to simplify using Autofac dependency injection .</PackageDescription>
13+
<PackageDescription>Add on to J4JCommandLine to simplify using Autofac dependency injection.</PackageDescription>
1514
<RepositoryUrl>https://github.com/markolbert/J4JCommandLine</RepositoryUrl>
1615
<PackageLicenseExpression>MIT</PackageLicenseExpression>
16+
<RepositoryType>git</RepositoryType>
17+
<PackageIcon>Diego nuspec.png</PackageIcon>
18+
<Version>0.5.0.0</Version>
19+
<AssemblyVersion>0.5.0.0</AssemblyVersion>
20+
<PackageReleaseNotes>added simpler way of specifying validators when using the autobind approach</PackageReleaseNotes>
1721
</PropertyGroup>
1822

1923
<ItemGroup>
@@ -25,4 +29,11 @@
2529
<ProjectReference Include="..\J4JCommandLine\J4JCommandLine.csproj" />
2630
</ItemGroup>
2731

32+
<ItemGroup>
33+
<None Include="E:\Pix\JumpForJoy\Diego nuspec.png">
34+
<Pack>True</Pack>
35+
<PackagePath></PackagePath>
36+
</None>
37+
</ItemGroup>
38+
2839
</Project>

FancyConsole/FancyConsole.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<Nullable>enable</Nullable>
66
<AssemblyName>J4JSoftware.CommandLine.FancyConsole</AssemblyName>
77
<RootNamespace>J4JSoftware.CommandLine</RootNamespace>
8-
<Version>0.1.0.0</Version>
98
<Authors>Mark A. Olbert</Authors>
109
<Company>Jump for Joy Software</Company>
1110
<Product>J4JSoftware Command Line Processor: Help/Error Console Output</Product>
@@ -15,6 +14,11 @@
1514
<RepositoryUrl>https://github.com/markolbert/J4JCommandLine</RepositoryUrl>
1615
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1716
<PackageProjectUrl>https://github.com/markolbert/J4JCommandLine</PackageProjectUrl>
17+
<PackageIcon>Diego nuspec.png</PackageIcon>
18+
<RepositoryType>git</RepositoryType>
19+
<Version>0.5.0.0</Version>
20+
<AssemblyVersion>0.5.0.0</AssemblyVersion>
21+
<PackageReleaseNotes>added simpler way of specifying validators when using the autobind approach</PackageReleaseNotes>
1822
</PropertyGroup>
1923

2024
<ItemGroup>
@@ -26,4 +30,11 @@
2630
<ProjectReference Include="..\J4JCommandLine\J4JCommandLine.csproj" />
2731
</ItemGroup>
2832

33+
<ItemGroup>
34+
<None Include="E:\Pix\JumpForJoy\Diego nuspec.png">
35+
<Pack>True</Pack>
36+
<PackagePath></PackagePath>
37+
</None>
38+
</ItemGroup>
39+
2940
</Project>

J4JCommandLine/J4JCommandLine.csproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<Nullable>enable</Nullable>
66
<AssemblyName>J4JSoftware.CommandLine</AssemblyName>
77
<RootNamespace>J4JSoftware.CommandLine</RootNamespace>
8-
<Version>0.1.0.0</Version>
98
<Authors>Mark A. Olbert</Authors>
109
<Company>Jump for Joy Software</Company>
1110
<Product>J4JSoftware Command Line Processor</Product>
@@ -15,7 +14,11 @@
1514
<RepositoryUrl>https://github.com/markolbert/J4JCommandLine</RepositoryUrl>
1615
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1716
<PackageProjectUrl>https://github.com/markolbert/J4JCommandLine</PackageProjectUrl>
18-
<AssemblyVersion>0.1.0.0</AssemblyVersion>
17+
<RepositoryType>git</RepositoryType>
18+
<PackageIcon>Diego nuspec.png</PackageIcon>
19+
<Version>0.5.0.0</Version>
20+
<AssemblyVersion>0.5.0.0</AssemblyVersion>
21+
<PackageReleaseNotes>added simpler way of specifying validators when using the autobind approach</PackageReleaseNotes>
1922
</PropertyGroup>
2023

2124
<ItemGroup>
@@ -28,4 +31,11 @@
2831
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.5" />
2932
</ItemGroup>
3033

34+
<ItemGroup>
35+
<None Include="E:\Pix\JumpForJoy\Diego nuspec.png">
36+
<Pack>True</Pack>
37+
<PackagePath></PackagePath>
38+
</None>
39+
</ItemGroup>
40+
3141
</Project>

J4JCommandLine/J4JCommandLineExtensions.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,21 @@ public static StringComparer ToStringComparer( this StringComparison textComp )
100100
_ => throw new NotImplementedException()
101101
};
102102
}
103+
104+
// sets the validator for an Option.
105+
public static IBindingTarget SetValidator(this IBindingTarget bindingTarget, string key, IOptionValidator validator)
106+
{
107+
var option = bindingTarget.Options[ key ];
108+
109+
if( option == null
110+
|| option.OptionType != OptionType.Keyed
111+
|| validator.SupportedType != option.TargetableType.SupportedType )
112+
return bindingTarget;
113+
114+
option.Validator = validator;
115+
116+
return bindingTarget;
117+
}
118+
103119
}
104120
}

J4JCommandLine/option/OptionExtensions.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,6 @@ namespace J4JSoftware.CommandLine
55
{
66
public static class OptionExtensions
77
{
8-
//// adds the specified key to the collection of keys defined for the Option provided it
9-
//// is not already in use by another Option
10-
//public static T AddKey<T>( this T option, string key )
11-
// where T : Option
12-
//{
13-
// if( option.OptionType == OptionType.Null )
14-
// return option;
15-
16-
// if( !option.Options.HasKey( key ) )
17-
// option.Keys.Add( key );
18-
19-
// return option;
20-
//}
21-
228
// adds the specified keys to the collection of keys defined for the Option provided each one
239
// is not already in use by another Option (skips duplicates)
2410
public static T AddKeys<T>(this T option, IEnumerable<string> keys)

examples/AutoBindExample/AutoBindExample.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<Nullable>enable</Nullable>
7+
<RootNamespace>J4JSoftware.CommandLine.Examples</RootNamespace>
8+
<Version>0.1.0.0</Version>
9+
<Authors>Mark A. Olbert</Authors>
10+
<Company>Jump for Joy Software</Company>
11+
<Product>J4JSoftware Command Line Processor</Product>
12+
<Description>auto binding example for J4JCommandLine</Description>
13+
<Copyright>© Mark A. Olbert all rights reserved</Copyright>
714
</PropertyGroup>
815

916
<ItemGroup>

examples/AutoBindExample/Program.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
using System.ComponentModel;
44
using Autofac;
55
using Autofac.Extensions.DependencyInjection;
6-
using J4JSoftware.CommandLine;
76
using Microsoft.Extensions.DependencyInjection;
87

9-
namespace AutoBindExample
8+
namespace J4JSoftware.CommandLine.Examples
109
{
1110
class Program
1211
{
@@ -26,9 +25,7 @@ static void Main(string[] args)
2625
if (binder == null)
2726
throw new NullReferenceException(nameof(Program));
2827

29-
var intOption = binder.Options[ "i" ];
30-
if( intOption != null )
31-
intOption.SetValidator( OptionInRange<int>.GreaterThan( 0 ) );
28+
binder.SetValidator("i", OptionInRange<int>.GreaterThan( 0 ) );
3229

3330
if (!binder.Parse(args))
3431
{

examples/InstancePropertyExample/Configuration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22

3-
namespace InstancePropertyExample
3+
namespace J4JSoftware.CommandLine.Examples
44
{
55
public class Configuration
66
{

examples/InstancePropertyExample/InstancePropertyExample.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
<OutputType>Exe</OutputType>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<Nullable>enable</Nullable>
6+
<RootNamespace>J4JSoftware.CommandLine.Examples</RootNamespace>
7+
<Version>0.1.0.0</Version>
8+
<Authors>Mark A. Olbert</Authors>
9+
<Company>Jump for Joy Software</Company>
10+
<Product>J4JSoftware Command Line Processor</Product>
11+
<Description>instance-binding example for J4JCommandLine</Description>
12+
<Copyright>© Mark A. Olbert all rights reserved</Copyright>
613
</PropertyGroup>
714

815
<ItemGroup>

examples/InstancePropertyExample/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using System;
22
using Autofac;
33
using Autofac.Extensions.DependencyInjection;
4-
using J4JSoftware.CommandLine;
54
using Microsoft.Extensions.DependencyInjection;
65

7-
namespace InstancePropertyExample
6+
namespace J4JSoftware.CommandLine.Examples
87
{
98
class Program
109
{

0 commit comments

Comments
 (0)