Fix cxxopts error
This commit is contained in:
parent
20bfd9307e
commit
f78525ab41
1 changed files with 7 additions and 7 deletions
|
|
@ -188,17 +188,17 @@ std::unique_ptr<cppast::cpp_file> parse_file(const cppast::libclang_compile_conf
|
||||||
|
|
||||||
int main(int argc, char* argv[]) try
|
int main(int argc, char* argv[]) try
|
||||||
{
|
{
|
||||||
cxxopts::Options options("cppast",
|
cxxopts::Options option_list("cppast",
|
||||||
"cppast - The commandline interface to the cppast library.\n");
|
"cppast - The commandline interface to the cppast library.\n");
|
||||||
// clang-format off
|
// clang-format off
|
||||||
options.add_options()
|
option_list.add_options()
|
||||||
("h,help", "display this help and exit")
|
("h,help", "display this help and exit")
|
||||||
("version", "display version information and exit")
|
("version", "display version information and exit")
|
||||||
("v,verbose", "be verbose when parsing")
|
("v,verbose", "be verbose when parsing")
|
||||||
("fatal_errors", "abort program when a parser error occurs, instead of doing error correction")
|
("fatal_errors", "abort program when a parser error occurs, instead of doing error correction")
|
||||||
("file", "the file that is being parsed (last positional argument)",
|
("file", "the file that is being parsed (last positional argument)",
|
||||||
cxxopts::value<std::string>());
|
cxxopts::value<std::string>());
|
||||||
options.add_options("compilation")
|
option_list.add_options("compilation")
|
||||||
("database_dir", "set the directory where a 'compile_commands.json' file is located containing build information",
|
("database_dir", "set the directory where a 'compile_commands.json' file is located containing build information",
|
||||||
cxxopts::value<std::string>())
|
cxxopts::value<std::string>())
|
||||||
("database_file", "set the file name whose configuration will be used regardless of the current file name",
|
("database_file", "set the file name whose configuration will be used regardless of the current file name",
|
||||||
|
|
@ -219,11 +219,11 @@ int main(int argc, char* argv[]) try
|
||||||
("fast_preprocessing", "enable fast preprocessing, be careful, this breaks if you e.g. redefine macros in the same file!")
|
("fast_preprocessing", "enable fast preprocessing, be careful, this breaks if you e.g. redefine macros in the same file!")
|
||||||
("remove_comments_in_macro", "whether or not comments generated by macro are kept, enable if you run into errors");
|
("remove_comments_in_macro", "whether or not comments generated by macro are kept, enable if you run into errors");
|
||||||
// clang-format on
|
// clang-format on
|
||||||
options.parse_positional("file");
|
option_list.parse_positional("file");
|
||||||
options.parse(argc, argv);
|
|
||||||
|
|
||||||
|
auto options = option_list.parse(argc, argv);
|
||||||
if (options.count("help"))
|
if (options.count("help"))
|
||||||
print_help(options);
|
print_help(option_list);
|
||||||
else if (options.count("version"))
|
else if (options.count("version"))
|
||||||
{
|
{
|
||||||
std::cout << "cppast version " << CPPAST_VERSION_STRING << "\n";
|
std::cout << "cppast version " << CPPAST_VERSION_STRING << "\n";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue