aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2022-03-07 08:04:08 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2022-03-07 08:04:08 +0000
commitb2eb476764a4424e98958381bacc4f00524a7884 (patch)
tree8ff7c46a318f6b46da4cf3f1e78d7aa78264c537 /tools
parentbe915d7374be9d64b6fd85819fcd98b300f511af (diff)
Tools: add script to check help URLs vs. available User's Guide chapters
Diffstat (limited to 'tools')
-rwxr-xr-xtools/check_help_urls.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/check_help_urls.py b/tools/check_help_urls.py
new file mode 100755
index 0000000000..d8a87ef6fe
--- /dev/null
+++ b/tools/check_help_urls.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python3
+# Wireshark - Network traffic analyzer
+# By Gerald Combs <gerald@wireshark.org>
+# Copyright 1998 Gerald Combs
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+'''
+Go through all user guide help URLs listed in the program
+and confirm these are present in the User's Guide source files.
+'''
+
+from re import search
+from glob import glob
+from sys import exit
+
+found = {}
+
+with open("ui/help_url.c") as f:
+ for line in f:
+ if url := search(r"user_guide_url\(\"(.*).html\"\);", line):
+ chapter = url.group(1)
+ found[chapter] = False
+
+adoc_files = glob("docbook/wsug_src/*.adoc")
+
+for adoc_file in adoc_files:
+ with open(adoc_file) as f:
+ for line in f:
+ if tag := search(r"^\[\#(.*)]", line):
+ chapter = tag.group(1)
+ if chapter in found:
+ found[chapter] = True
+
+missing = False
+
+for chapter in found:
+ if not found[chapter]:
+ if not missing:
+ print("The following chapters are missing in the User's Guide:")
+ missing = True
+ print(chapter)
+
+if missing:
+ exit(-1)