Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghcup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gershomb
ghcup
Commits
ff9261ba
Unverified
Commit
ff9261ba
authored
6 years ago
by
Julian Ospald
Browse files
Options
Downloads
Plain Diff
Merge branch 'changelog-subcommand'
parents
8e634b94
12f9f155
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghcup
+88
-0
88 additions, 0 deletions
ghcup
with
88 additions
and
0 deletions
ghcup
+
88
−
0
View file @
ff9261ba
...
...
@@ -192,6 +192,7 @@ SUBCOMMANDS:
rm Remove an already installed GHC
install-cabal Install cabal-install
debug-info Print debug info (e.g. detected system/distro)
changelog Show the changelog of a GHC release (online)
DISCUSSION:
ghcup installs the Glasgow Haskell Compiler from the official
...
...
@@ -420,6 +421,32 @@ DISCUSSION:
exit
1
}
# @FUNCTION: changelog_usage
# @DESCRIPTION:
# Print the help message for 'ghcup set' to STDERR
# and exit the script with status code 1.
changelog_usage
()
{
(>
&2
echo
"ghcup-changelog
View the online changelog for the given GHC version
USAGE:
${
SCRIPT
}
changelog [FLAGS] [VERSION|TAG]
FLAGS:
-h, --help Prints help information
ARGS:
[VERSION|TAG] E.g.
\"
8.4.3
\"
or
\"
8.6.3
\"
or
a tag like
\"
recommended
\"
or
\"
latest
\"
(default: discovers latest version)
DISCUSSION:
Opens the online changelog for the given GHC version via
xdg-open.
"
)
exit
1
}
...
...
@@ -1695,6 +1722,39 @@ list() {
}
##############################
#--[ Subcommand changelog ]--#
##############################
# @FUNCTION: changelog_url
# @USAGE: <ghcversion>
# @DESCRIPTION:
# Print the changelog url for the given GHC version to stdout.
# @STDOUT: the changelog url
changelog_url
()
{
[
-z
"
$1
"
]
&&
die
"Internal error: no argument given to changelog"
printf
"https://downloads.haskell.org/~ghc/%s/docs/html/users_guide/%s-notes.html"
"
$1
"
"
$1
"
}
# @FUNCTION: changelog
# @USAGE: <ghcversion>
# @DESCRIPTION:
# Opens the changelog for the given ghc version via xdg-open.
changelog
()
{
[
-z
"
$1
"
]
&&
die
"Internal error: no argument given to changelog"
url
=
$(
changelog_url
"
$1
"
)
xdg-open
"
${
url
}
"
||
die
"failed to xdg-open the following url:
${
url
}
"
unset
url
}
#######################
#--[ Sanity checks ]--#
...
...
@@ -1940,6 +2000,34 @@ while [ $# -gt 0 ] ; do
done
list
"
${
TOOL
}
"
break
;;
changelog
)
shift
1
while
[
$#
-gt
0
]
;
do
case
$1
in
-h
|
--help
)
changelog_usage
;;
-f
|
--force
)
FORCE
=
true
shift
1
;;
*
)
GHC_VER
=
$1
break
;;
esac
done
if
[
-z
"
${
GHC_VER
}
"
]
;
then
_tool_ver
=
"
$(
get_tool_ver_from_tag
"ghc"
"latest"
)
"
if
[
-z
"
${
_tool_ver
}
"
]
;
then
die
"Could not find a latest GHC version, please report a bug at
${
BUG_URL
}
!"
fi
changelog
"
${
_tool_ver
}
"
else
# could be a version or a tag, let's check
if
array_contains
"
${
GHC_VER
}
"
"
$(
known_tool_versions
"ghc"
)
"
;
then
changelog
"
${
GHC_VER
}
"
elif
array_contains
"
${
GHC_VER
}
"
"
$(
known_tool_tags
"ghc"
)
"
;
then
changelog
"
$(
get_tool_ver_from_tag
"ghc"
"
${
GHC_VER
}
"
)
"
else
die
"
\"
${
GHC_VER
}
\"
is not a known version or tag!"
fi
fi
break
;;
*
)
usage
;;
esac
break
;;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment