Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
b9c4e2e8
Unverified
Commit
b9c4e2e8
authored
Mar 31, 2023
by
Guy Sartorelli
Committed by
GitHub
Mar 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(changelog): provide links in changelog (#11578)
parent
7837ba6a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
2 deletions
+96
-2
changelog.sh
tools/changelog.sh
+96
-2
No files found.
tools/changelog.sh
View file @
b9c4e2e8
...
@@ -157,6 +157,89 @@ function parse-commit {
...
@@ -157,6 +157,89 @@ function parse-commit {
fi
fi
}
}
################################
# SUPPORTS HYPERLINKS FUNCTION #
################################
# The code for checking if a terminal supports hyperlinks is copied from install.sh
# The [ -t 1 ] check only works when the function is not called from
# a subshell (like in `$(...)` or `(...)`, so this hack redefines the
# function at the top level to always return false when stdout is not
# a tty.
if
[
-t
1
]
;
then
is_tty
()
{
true
}
else
is_tty
()
{
false
}
fi
# This function uses the logic from supports-hyperlinks[1][2], which is
# made by Kat Marchán (@zkat) and licensed under the Apache License 2.0.
# [1] https://github.com/zkat/supports-hyperlinks
# [2] https://crates.io/crates/supports-hyperlinks
#
# Copyright (c) 2021 Kat Marchán
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
supports_hyperlinks
()
{
# $FORCE_HYPERLINK must be set and be non-zero (this acts as a logic bypass)
if
[
-n
"
$FORCE_HYPERLINK
"
]
;
then
[
"
$FORCE_HYPERLINK
"
!=
0
]
return
$?
fi
# If stdout is not a tty, it doesn't support hyperlinks
is_tty
||
return
1
# DomTerm terminal emulator (domterm.org)
if
[
-n
"
$DOMTERM
"
]
;
then
return
0
fi
# VTE-based terminals above v0.50 (Gnome Terminal, Guake, ROXTerm, etc)
if
[
-n
"
$VTE_VERSION
"
]
;
then
[
$VTE_VERSION
-ge
5000
]
return
$?
fi
# If $TERM_PROGRAM is set, these terminals support hyperlinks
case
"
$TERM_PROGRAM
"
in
Hyper|iTerm.app|terminology|WezTerm
)
return
0
;;
esac
# kitty supports hyperlinks
if
[
"
$TERM
"
=
xterm-kitty
]
;
then
return
0
fi
# Windows Terminal also supports hyperlinks
if
[
-n
"
$WT_SESSION
"
]
;
then
return
0
fi
# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected
# https://github.com/ohmyzsh/ohmyzsh/issues/10964
# if [ -n "$KONSOLE_VERSION" ]; then
# return 0
# fi
return
1
}
#############################
#############################
# RELEASE CHANGELOG DISPLAY #
# RELEASE CHANGELOG DISPLAY #
#############################
#############################
...
@@ -208,7 +291,13 @@ function display-release {
...
@@ -208,7 +291,13 @@ function display-release {
local hash
=
"
${
1
:-
$hash
}
"
local hash
=
"
${
1
:-
$hash
}
"
case
"
$output
"
in
case
"
$output
"
in
raw
)
printf
'%s'
"
$hash
"
;;
raw
)
printf
'%s'
"
$hash
"
;;
text
)
printf
'\e[33m%s\e[0m'
"
$hash
"
;;
# red
text
)
local
text
=
"
\e
[33m
$hash
\e
[0m"
;
# red
if
supports_hyperlinks
;
then
printf
"
\e
]8;;%s
\a
%s
\e
]8;;
\a
"
"https://github.com/ohmyzsh/ohmyzsh/commit/
$hash
"
$text
;
else
echo
$text
;
fi
;;
md
)
printf
'[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)'
"
$hash
"
"
$hash
"
;;
md
)
printf
'[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)'
"
$hash
"
"
$hash
"
;;
esac
esac
}
}
...
@@ -272,7 +361,12 @@ function display-release {
...
@@ -272,7 +361,12 @@ function display-release {
case
"
$output
"
in
case
"
$output
"
in
raw
)
printf
'%s'
"
$subject
"
;;
raw
)
printf
'%s'
"
$subject
"
;;
# In text mode, highlight (#<issue>) and dim text between `backticks`
# In text mode, highlight (#<issue>) and dim text between `backticks`
text
)
sed
-E
$'s|#([0-9]+)|
\e
[32m#
\\
1
\e
[0m|g;s|`([^`]+)`|`
\e
[2m
\\
1
\e
[0m`|g'
<<<
"
$subject
"
;;
text
)
if
supports_hyperlinks
;
then
sed
-E
$'s|#([0-9]+)|
\e
]8;;https://github.com/ohmyzsh/ohmyzsh/issues/
\\
1
\a\e
[32m#
\\
1
\e
[0m
\e
]8;;
\a
|g'
<<<
"
$subject
"
else
sed
-E
$'s|#([0-9]+)|
\e
[32m#
\\
1
\e
[0m|g;s|`([^`]+)`|`
\e
[2m
\\
1
\e
[0m`|g'
<<<
"
$subject
"
fi
;;
# In markdown mode, link to (#<issue>) issues
# In markdown mode, link to (#<issue>) issues
md
)
sed
-E
's|#([0-9]+)|[#\1](https://github.com/ohmyzsh/ohmyzsh/issues/\1)|g'
<<<
"
$subject
"
;;
md
)
sed
-E
's|#([0-9]+)|[#\1](https://github.com/ohmyzsh/ohmyzsh/issues/\1)|g'
<<<
"
$subject
"
;;
esac
esac
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment