j-maly / CommandLineParser

Command line parser. Declarative arguments support. Rich set of argument types (switches, enums, files, etc...). Mutually exclusive arguments validations.
MIT License
136 stars 30 forks source link

Option that allows additional parameters #54

Open kvchernyaev opened 6 years ago

kvchernyaev commented 6 years ago

The existing option AdditionalArgumentsSettings.AcceptAdditionalArguments = true throws an exception UnknownArgumentException if a not defined parameter passed. I need an option to allow unknown arguments.

j-maly commented 6 years ago

Check out https://github.com/j-maly/CommandLineParser/wiki/Command-line-format AcceptAdditionalArguments allows to verify parameters not starting with - or --, like the directories in this example: Finder.exe -s 3 --distinct directory1 directory2 directory3

If you want to allow unkown arguments starting with - or --, this is not supported.

kvchernyaev commented 6 years ago

Can i do it myself and make pull request? I want to allow (by option) parameters

  1. obsoleted and excluded from source code
  2. like -Dname=val so pairs (name,val) can be used as not strictly defined configuration
j-maly commented 6 years ago

Sounds interesting, sure, I am happy to accept pull requests

alexandre-lecoq commented 5 years ago

Maybe that should be done in https://github.com/j-maly/CommandLineParser/blob/40120ac02a670dae0ace4e21103d97be370ad46e/src/CommandLineArgumentsParser/CommandLineParser.cs#L595

Such that LookupArgument() should return a new instance of an Argument derived type if no argument is found ?