I am using llvm CommandLine library for argument parsing in one of my C++ projects. It has an option which accepts multiple logging levels, which is of enum type as below:
enum LogLevels {
error,
critical_warnings,
all_warnings,
info,
trace
};
cl::OptionCategory Logging("Verbose Options:");
cl::opt<LogLevels> verbose("logging", cl::desc("Control logging levels:"),
cl::values(
clEnumValN(error,"error-only", "Level:1 - Report fatal errors"),
clEnumValN(critical_warnings,"critical-warnings", "Level:2 - Report critical warnings and errors (default)"),
clEnumValN(all_warnings, "all-warnings", "Level:3 - Report all warnings and errors"),
clEnumValN(info, "info", "Level:4 - Report info messages along with error/warnings"),
clEnumValN(trace, "trace", "Level:5 - Report all internal/developer details in logs")),
cl::init(LogLevels::critical_warnings), cl::cat(Logging)
);
How can I hide a particular enum value from user help string (output of -help) but still continue to accept it? In this case, I want to hide "trace" from the user help string and still continue to accept --logging=trace for internal use only.
I tried looking at https://llvm.org/docs/CommandLine.html# but couldn't figure it out. I need something similar to the cl::Hidden or cl::ReallyHidden modifiers, but for enum values.
Current output from -help is:
Verbose Options::
--logging=<value> - Control logging levels:
=error-only - Level:1 - Report fatal errors
=critical-warnings - Level:2 - Report critical warnings and errors (default)
=all-warnings - Level:3 - Report all warnings and errors
=info - Level:4 - Report info messages along with error/warnings
=trace - Level:5 - Report all internal/developer details in logs