anubis221
anubis221

Reputation: 23

Help flags with Console App

I'm using Visual Studio C# Express 2010 to make a console application. I've implemented the 'commands' as if sections in the Prompt method calling a command method, eg

if (line == "help")
            {
                Help();
            }

That gives you a help page on my program. If it needs cleaning up that's fine.

What I'm trying to figure out is how I can, say, have the user type in a command followed by ? and get command-specific help, rather than just a blanket help page. I don't have any code attempts because I deleted them earlier, but I'll keep coding.

Cheers for your help.

Upvotes: 2

Views: 4451

Answers (2)

rerun
rerun

Reputation: 25505

 `if (line.indexof("?") != -1) Help()`

Upvotes: 0

Reed Copsey
Reed Copsey

Reputation: 564631

Here is an article detailing a fairly fully functional Command Line Parser in C#.

It demonstrates how to parse complex command lines following the "standard" techniques of specifying information on a command line.

Upvotes: 3

Related Questions