下面的默认功能在我执行时没有被执行myExe.exe
,但是在我运行时它正在执行myExe.exe -launch
。关于为什么此应用程序默认不执行的任何想法?根据文档,这应该可以
文档摘录:
As a fallback, a default handler may be registered which will handle all arguments which are not handled by any of the above matching algorithms. The default handler is designated by the name <> (which may be an alias for another named NDesk.Options.Option).
我的代码:
public static void Main (string[] args)
{
bool showHelp = false;
var options = new OptionSet() {
{
"h", "Show help",
v => showHelp = true
}, {
"config", "Reconfigure the launcher with different settings",
v => PromptConfig()
}, {
"v", "Show current version",
v => ShowVersion()
}, {
"launch",
v => LaunchApplication()
}, {
"<>", //default
v => LaunchApplication()
}
};
//handle arguments
List<string> extra;
try {
extra = options.Parse (args);
}
catch (OptionException e) {
Console.Write("MyApp:");
Console.WriteLine(e.Message);
Console.WriteLine("Try `MyApp--help' for more information");
return;
}
if (showHelp) {
ShowHelp(options);
return;
}
}