开发者

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.


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.


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜