summaryrefslogtreecommitdiffstats
path: root/tools/gen-bugnote
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /tools/gen-bugnote
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/gen-bugnote')
-rwxr-xr-xtools/gen-bugnote54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/gen-bugnote b/tools/gen-bugnote
new file mode 100755
index 0000000..786886e
--- /dev/null
+++ b/tools/gen-bugnote
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# Given a Wireshark issue ID, fetch its title and prepare an entry suitable
+# for pasting into the release notes. Requires curl and jq.
+#
+# Usage: gen-bugnote <issue number>
+#
+# Copyright 2013 Gerald Combs
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+
+gitlab_issue_url_pfx="https://gitlab.com/api/v4/projects/wireshark%2Fwireshark/issues"
+issue_id="${1#\#}" # Strip leading "#"
+
+case "$OSTYPE" in
+ darwin*)
+ clipboard_cmd="pbcopy -Pascii"
+ ;;
+ cygwin*)
+ clipboard_cmd="cat > /dev/clipboard"
+ ;;
+ linux*)
+ clipboard_cmd="xsel --clipboard"
+ ;;
+ *)
+ echo "Unable to copy to clipboard"
+ clipboard_cmd="cat > /dev/null"
+ ;;
+esac
+
+if [ -z "$issue_id" ] ; then
+ echo "Usage: $( basename "$0" ) <issue id>"
+ exit 1
+fi
+
+issue_title=$(
+ curl -s -o - "${gitlab_issue_url_pfx}/$issue_id" \
+ | jq '.title'
+ )
+
+# We can escape backslashes in jq's --raw-output or we can trim quotes off
+# its plain output.
+issue_title="${issue_title%\"}"
+issue_title="${issue_title#\"}"
+trailing_period=""
+if [[ ! ${issue_title: -1} =~ [[:punct:]] ]] ; then
+ trailing_period="."
+fi
+
+printf "* %s%s wsbuglink:${issue_id}[].\\n" "$issue_title" "$trailing_period" \
+ | $clipboard_cmd
+
+echo "Copied $issue_id: $issue_title"