This is a nice little command line parser based on
Ray Hayes codeproject article
Automatic Command Line Parsing in C#. I have adapted it to VB.NET and upgraded it to .NET 3.5.
An updated command line parser that has a built in commanding architecture. The usage varies depending on what you are trying to achieve, but you can have commands, nested commands and delegate commands.
You just add this assembly to your project and adda bunch of command objects:
Module DemoModule
Sub Main(ByVal args() As String)
' Create root command collection
Dim root As New CommandCollection("root", Nothing)
' Add "demo1" fixed command
root.AddCommand(New Demo1Command)
' Create sub command colleciton
Dim innerlist As New CommandCollection("subcmd", root)
' Add "demo2" delegate comamnd
innerlist.AddCommand(New DelegateCommand(Of Demo3CommandLine)("Demo2", AddressOf OnDemo2Run, "demo 3", "no additional information", "demo 2 command", "This command shows how to delegate the run method using the delegate command"))
' Add "demo3" fixed command
innerlist.AddCommand(New Demo3Command)
' Add sub command collcection to root
root.AddCommand(innerlist)
' Start run
root.Run(args)
If Debugger.IsAttached Then
Console.ReadKey()
End If
End Sub
Private Function OnDemo2Run() As Integer
Console.WriteLine("Running demo 2")
Return 0
End Function
End Module