From: Miod Vallat Date: Thu, 17 Apr 2025 06:07:43 +0000 (+0200) Subject: Add a global quiet option to pdnsutil to silence some messaces. X-Git-Tag: dnsdist-2.0.0-alpha2~71^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=150bdb6f55c5b2329f325cdacf167720093aee23;p=thirdparty%2Fpdns.git Add a global quiet option to pdnsutil to silence some messaces. --- diff --git a/docs/manpages/pdnsutil.1.rst b/docs/manpages/pdnsutil.1.rst index 0857c93da6..a6ccf7060c 100644 --- a/docs/manpages/pdnsutil.1.rst +++ b/docs/manpages/pdnsutil.1.rst @@ -19,8 +19,9 @@ Options ------- -h, --help Show summary of options --v, --verbose Be more verbose. ---force Force an action +-v, --verbose Be more verbose +-f, --force Force an action +-q, --quiet Be quiet --config-name Virtual configuration name --config-dir Location of pdns.conf. Default is /etc/powerdns. diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index ea202ea925..1f2c504661 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -60,8 +60,9 @@ po::variables_map g_vm; string g_programname="pdns"; namespace { - bool g_verbose; bool g_force; + bool g_quiet; + bool g_verbose; } ArgvMap &arg() @@ -191,7 +192,7 @@ public: UtilBackend::~UtilBackend() { - if (hasCreatedLocalFiles()) { + if (!g_quiet && hasCreatedLocalFiles()) { cout<<"WARNING: local files have been created as a result of this operation."<& cmds, [[maybe_unused]] const std::str { bool quiet = (cmds.size() >= 2 && cmds.at(1) == "quiet"); DNSSECKeeper dk; //NOLINT(readability-identifier-length) - if (!rectifyAllZones(dk, quiet)) { + if (!rectifyAllZones(dk, quiet || g_quiet)) { return 1; } return 0; @@ -4859,7 +4860,8 @@ try ("help,h", "produce help message") ("version", "show version") ("verbose,v", "be verbose") - ("force", "force an action") + ("force,f", "force an action") + ("quiet,q", "be quiet") ("config-name", po::value()->default_value(""), "virtual configuration name") ("config-dir", po::value()->default_value(SYSCONFDIR), "location of pdns.conf") ("no-colors", "do not use colors in output") @@ -4876,8 +4878,9 @@ try cmds = g_vm["commands"].as >(); } - g_verbose = g_vm.count("verbose") != 0; g_force = g_vm.count("force") != 0; + g_quiet = g_vm.count("quiet") != 0; + g_verbose = g_vm.count("verbose") != 0; if (g_vm.count("version") != 0) { cout<<"pdnsutil "<