summaryrefslogtreecommitdiff
path: root/src/test-command.cc
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@greenend.org.uk>2014-05-02 21:38:44 +0100
committerRichard Kettlewell <rjk@greenend.org.uk>2014-05-02 21:38:44 +0100
commit97fea7c648d3342c0ad119e08a195f00454bf6b7 (patch)
tree19115312c93f5111fb8bffc0ed4e5a99d6da232f /src/test-command.cc
parent54f70f2c03da4d868eefcb0c8a997a9d121a0022 (diff)
Command: add missing --help entries
Diffstat (limited to 'src/test-command.cc')
-rw-r--r--src/test-command.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test-command.cc b/src/test-command.cc
new file mode 100644
index 0000000..b38062c
--- /dev/null
+++ b/src/test-command.cc
@@ -0,0 +1,32 @@
+// Copyright © 2014 Richard Kettlewell.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+#include <config.h>
+#include "Command.h"
+#include "Conf.h"
+#include <getopt.h>
+
+int main() {
+ int errors = 0;
+ const std::string h = Command::helpString();
+ for(size_t n = 0; Command::options[n].name; ++n) {
+ std::string full = "--" + std::string(Command::options[n].name);
+ if(h.find(full + ",") == std::string::npos
+ && h.find(full + " ") == std::string::npos) {
+ fprintf(stderr, "ERROR: help for option %s not found\n", full.c_str());
+ ++errors;
+ }
+ }
+ return !!errors;
+}