次のように私はオプションを定義していますコマンドラインパーサー動詞のヘルプが機能していませんか?
public class ArgumentsHeader
{
[VerbOption("configure", HelpText = "Sets configuration on server.")]
public ServerConfigurationArguments ServerConfigurationArguments { get; set; }
[HelpVerbOption]
public string GetUsage(string s)
{
return HelpText.AutoBuild(this, s);//always just 'help' or null showing up here.
}
}
public class ServerConfigurationArguments : ArgumentsBase
{
[Option('f', "filename", HelpText = "Path to JSON configuration file", DefaultValue = "config.json", Required = true)]
public string PathToConfig { get; set; }
}
を次に、このようにそれらを解析:
string invokedVerb = null;
object invokedVerbInstance = null;
var parser = new Parser(x =>
{
x.MutuallyExclusive = true;
});
var options = new ArgumentsHeader();
if (!parser.ParseArguments(args, options,
(verb, subOptions) =>
{
// if parsing succeeds the verb name and correct instance
// will be passed to onVerbCommand delegate (string,object)
invokedVerb = verb;
invokedVerbInstance = subOptions;
}))
{
Exit(ExitStatus.InvalidArguments);
}
しかし、私は「ヘルプのconfigure」で私のexeファイルを実行しようとした場合、それだけで全体のヘルプをプリントアウトし、 GetUsage(string)メソッドでは、デバッガに表示される「help」コマンドだけがあります。
これはバグですか、それとも何ですか?
あなたが使用しているcmd argsライブラリなどのコンテキスト情報を少し追加するのを忘れたと思います。 – Tamas
私は3タイトルの単語が実際の名前を見つけるのに役立つと思う:コマンドラインパーサー – eocron
ありがとう。私はそれらのものを見逃した。この場合、これは間違いなく問題です。[ここ](https://github.com/gsscoder/commandline/issues/298)と[ここ](https://github.com/gsscoder/)で確認できます。コマンドライン/ issue/347)。 – Tamas