Skip to content

Commit

Permalink
Verify Remaining Arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtule committed Jul 9, 2017
1 parent 57592bc commit c41bb22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions ManyConsole.CommandLineUtils/ConsoleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ internal void Register(CommandLineApplication app)
return 2;
}

if(RemainingArgumentsCount != 0){
var actCount =(remainingArgs?.Values.Count() ?? 0);
if(actCount < RemainingArgumentsCount){
c.Out.WriteLine("Invalid number of arguments-- expected {1} more.", RemainingArgumentsCount - actCount);
c.ShowHelp();
return 2;
}
}

return Run(remainingArgs?.Values.ToArray() ?? new string []{});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<Description>A near drop-in replacement for ManyConsole, wrapping Microsoft.Extensions.CommandLineUtils</Description>
<Authors> Jay Tuley, Frank Schwieterman, Jonathan Pryor </Authors>
<Copyright>Copyright 2017</Copyright>
<AssemblyVersion>1.0.2.0</AssemblyVersion>
<FileVersion>1.0.2.0</FileVersion>
<AssemblyVersion>1.0.3.0</AssemblyVersion>
<FileVersion>1.0.3.0</FileVersion>
<PackageProjectUrl>https://github.com/jbtule/ManyConsole.CommandLineUtils</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/jbtule/ManyConsole.CommandLineUtils/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageTags>command-line console parsing manyconsole ndesk CommandLineUtils</PackageTags>
<IncludeSymbols>True</IncludeSymbols>
<IncludeSource>True</IncludeSource>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Version>1.0.2-alpha</Version>
<Version>1.0.3-alpha</Version>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net20'">
Expand Down

0 comments on commit c41bb22

Please sign in to comment.