Hello out there
I have a question about making a custom command line program (like a console) - The only thing I'm currently looking for is an 'advanced' but easy-to-use way of parsing commands with arguments.
I wan't to register my commands in either a
List(Of String)
or an
Array()
to make it easy. Also I wan't to define how many arguments a command may and can have.
Let's say I have registered a command called
Custom
and it have two arguments on that is
required and one that is
optional so whenever I enter
Custom Argument1 Argument2
I can use these two arguments within my code but if I don't wanna use
Argument2
so I use it as
Custom Argument1
it will still run but only with Argument1 (and with no arguments at all it should throw an error)
I have been looking in to command line programs with arguments, but haven't found the way I wan't it. The reason why I'm looking for this, is that I wan't to create a console which runs in a form -
NOT command line program (or command prompt)
An example in my head of registering commands with
List(Of String)
called
Commands
:
Commands.Add("run <{0}> [{1}]")
where
run
is my command and
<{0}>
is the required argument and
[{1}]
is the optional argument.
will register
Command
with
1
required argument and
1
optional argument.
So when I use it in my code:
Select Case Commands
Case "run"
_output.Text = "Command: " & Command & " - Arguments: " & Argument(0) & " " & Argument(1)
End Select
Remember, only an idea maybe you have somthing easier builded upon this.
NOTE: This is NOT to parse arguments trough command prompt or a command line program. It is a form with 2 textboxes (an INPUT and OUTPUT).
I hope you can help me with this, and will really appriciate it.
Best Regards,
SyncError