dcerpc-nt: add UNION_ALIGN_TO... helpers
[wireshark-sm.git] / tools / gen-bugnote
blobe487cd26bd835ecd8eee72e475b06d88528f0728
1 #!/bin/bash
3 # Given a Wireshark issue ID, fetch its title and prepare an entry suitable
4 # for pasting into the release notes. Requires curl and jq.
6 # Usage: gen-bugnote <issue number>
8 # Copyright 2013 Gerald Combs
10 # SPDX-License-Identifier: GPL-2.0-or-later
13 gitlab_issue_url_pfx="https://gitlab.com/api/v4/projects/wireshark%2Fwireshark/issues"
14 issue_id="${1#\#}" # Strip leading "#"
16 case "$OSTYPE" in
17 darwin*)
18 clipboard_cmd="pbcopy -Pascii"
20 cygwin*)
21 clipboard_cmd="cat > /dev/clipboard"
23 linux*)
24 clipboard_cmd="xsel --clipboard"
27 echo "Unable to copy to clipboard"
28 clipboard_cmd="cat > /dev/null"
30 esac
32 if [ -z "$issue_id" ] ; then
33 echo "Usage: $( basename "$0" ) <issue id>"
34 exit 1
37 issue_title=$(
38 curl --silent "${gitlab_issue_url_pfx}/$issue_id" \
39 | jq --raw-output '.title'
42 issue_title="${issue_title//\\/\{backslash\}}"
43 trailing_period=""
44 if [[ ! ${issue_title: -1} =~ [[:punct:]] ]] ; then
45 trailing_period="."
48 printf "* %s%s wsbuglink:${issue_id}[].\\n" "$issue_title" "$trailing_period" \
49 | $clipboard_cmd
51 echo "Copied $issue_id: $issue_title"