私はJcommanderライブラリを使用してコマンドライン引数を解析しています。 私の問題は、Jcommanderによって生成された使用メッセージのフォーマットにあります。 これは、使用関数の出力です:Jcommanderの使用フォーマット
Usage: mvnUploader [options]
Options:
* -d, --directory
the directory of the artifacts to upload
-h, --help
print help message
私はオプションと説明が同じ行になることを望んでは
マイ引数クラス:私は
public class OptionalArgs {
@Parameter(names = {"-d", "--directory"}, required = true, description =
"the directory of the artifacts to upload")
private String pathToArtifacts;
@Parameter(names ={"-h", "--help"} , help = true, description = "print help
message")
private boolean help = false;
public String getPathToArtifacts() {
return pathToArtifacts;
}
public boolean isHelp() {
return help;
}
}
使用方法の形式はハードコードされています。 'usage()'の実装が異なる 'JCommander'の独自のサブクラスを書くことができます。 – RealSkeptic