2013-04-23 19:21:18 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2020-09-09 00:54:41 +00:00
|
|
|
# Given a Wireshark issue ID, fetch its title and prepare an entry suitable
|
|
|
|
# for pasting into the release notes. Requires curl and jq.
|
2013-04-23 19:21:18 +00:00
|
|
|
#
|
2020-09-09 00:54:41 +00:00
|
|
|
# Usage: gen-bugnote <issue number>
|
2013-04-23 19:21:18 +00:00
|
|
|
#
|
|
|
|
# Copyright 2013 Gerald Combs
|
|
|
|
#
|
2018-03-07 14:28:51 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2013-04-23 19:21:18 +00:00
|
|
|
#
|
|
|
|
|
2020-09-09 00:54:41 +00:00
|
|
|
gitlab_issue_url_pfx="https://gitlab.com/api/v4/projects/wireshark%2Fwireshark/issues"
|
2020-09-23 19:34:28 +00:00
|
|
|
issue_id="${1#\#}" # Strip leading "#"
|
2013-09-07 00:18:10 +00:00
|
|
|
|
2013-04-23 19:21:18 +00:00
|
|
|
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
|
|
|
|
|
2020-09-09 00:54:41 +00:00
|
|
|
if [ -z "$issue_id" ] ; then
|
|
|
|
echo "Usage: $( basename "$0" ) <issue id>"
|
2013-04-23 19:21:18 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-09-09 00:54:41 +00:00
|
|
|
issue_title=$(
|
|
|
|
curl -s -o - "${gitlab_issue_url_pfx}/$issue_id" \
|
|
|
|
| jq --raw-output '.title'
|
2016-12-19 19:04:09 +00:00
|
|
|
)
|
2013-04-23 19:21:18 +00:00
|
|
|
|
2020-09-09 00:54:41 +00:00
|
|
|
echo -e "* $issue_title wsbuglink:${issue_id}[].\\n" \
|
|
|
|
| $clipboard_cmd
|
2013-04-23 19:21:18 +00:00
|
|
|
|
2020-09-09 00:54:41 +00:00
|
|
|
echo "Copied $issue_id: $issue_title"
|