Add --debug switch and enable debugging if it is on.

This commit is contained in:
tastytea 2021-06-01 13:41:54 +02:00
parent b12f88003b
commit 28c0a5a797
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 9 additions and 0 deletions

View File

@ -80,6 +80,11 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
if (opts.debug)
{
log::enable_debug();
}
if (opts.help || opts.version)
{
return EXIT_SUCCESS;

View File

@ -88,6 +88,8 @@ options parse_options(int argc, char *argv[])
"following symlinks.") .str().data())
("ignore-archive-errors",
translate("Ignore errors about wrong file formats.") .str().data())
("debug",
translate("Enable debug output.") .str().data())
;
po::options_description options_hidden("Hidden options");
@ -226,6 +228,7 @@ options parse_again(const po::variables_map &vm)
opts.recursive = vm.count("recursive") > 0;
opts.dereference_recursive = vm.count("dereference-recursive") > 0;
opts.ignore_archive_errors = vm.count("ignore-archive-errors") > 0;
opts.debug = vm.count("debug") > 0;
if (vm.count("regexp") > 0)
{

View File

@ -55,6 +55,7 @@ struct options
bool dereference_recursive{false};
std::vector<std::string> input_file;
bool ignore_archive_errors{false};
bool debug{false};
};
//! Parse options and return them.