When I run standalone-translate executable file, I expect the following command option can be different from its description. However, I can not separately set the description, which means there must be some unexpected relationship of command option and command description in mlir repository. I have found the error in mlir/lib/Tools/mlir-translate/Translation.cpp as shown in Code Snippet 1. To make application programmer make use of the description, there should be some override functions to provide this customized description.
# things now (unexpected)
OVERVIEW: MLIR Translation Tool
USAGE: standalone-translate [options] <input file>
OPTIONS:
Color Options:
--color - Use colors in output (default=autodetect)
General options:
Translation to perform
--myoption - myoption# expected
OVERVIEW: MLIR Translation Tool
USAGE: standalone-translate [options] <input file>
OPTIONS:
Color Options:
--color - Use colors in output (default=autodetect)
General options:
Translation to perform
--myoption - something different// Code Snippet 1
TranslationParser::TranslationParser(llvm::cl::Option &opt)
: llvm::cl::parser<const TranslateFunction *>(opt) {
for (const auto &kv : getTranslationRegistry())
addLiteralOption(kv.first(), &kv.second, kv.first()); // argument 0 is option, argument 2 is description. It should be different.
}Test Plan:
The additional description can be tested by the standalone project.
I would just always require a description.