FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Querya-Desktop/scripts/extract-changelog-section.sh at main · QueryaHub/Querya-Desktop · GitHub
QueryaHub
/
Querya-Desktop
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
21
Code
Issues
15
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Querya-Desktop
/
scripts
/
extract-changelog-section.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
33 lines (29 loc) · 701 Bytes
Breadcrumbs
Querya-Desktop
/
scripts
/
extract-changelog-section.sh
Copy path
File metadata and controls
executable file
·
33 lines (29 loc) · 701 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!
/usr/bin/env bash
#
Extract one Keep a Changelog section from CHANGELOG.md by semver (e.g. 0.4.3 or v0.4.3).
set
-euo pipefail
VERSION=
"
${1
:?
usage
:
extract-changelog-section.sh <version> [changelog-file]}
"
CHANGELOG=
"
${2
:-
CHANGELOG.md}
"
VERSION=
"
${VERSION
#
v}
"
if
[[
!
-f
"
$CHANGELOG
"
]]
;
then
echo
"
error: changelog not found:
$CHANGELOG
"
>&2
exit
1
fi
awk -v ver=
"
$VERSION
"
'
BEGIN { found = 0; capture = 0 }
/^## \[/ {
if (capture) exit
if ($0 ~ "^## \\[" ver "\\]") {
found = 1
capture = 1
print
next
}
}
capture { print }
END {
if (!found) {
print "error: no changelog section for version " ver " in " FILENAME > "/dev/stderr"
exit 1
}
}
'
"
$CHANGELOG
"
Back
|
FazBrowse Home
|
New Git URL