Document the hyperlink helper

This commit is contained in:
Mislav Marohnić 2022-10-31 15:04:53 +01:00
parent 9ea76237a5
commit dbc244a993
No known key found for this signature in database

View file

@ -121,6 +121,7 @@ var HelpTopics = map[string]map[string]string{
- %[1]stimeago <time>%[1]s: renders a timestamp as relative to now
- %[1]stimefmt <format> <time>%[1]s: formats a timestamp using Go's Time.Format function
- %[1]struncate <length> <input>%[1]s: ensures input fits within length
- %[1]shyperlink <url> <text>%[1]s: renders a terminal hyperlink
To learn more about Go templates, see: <https://golang.org/pkg/text/template/>.
`, "`"),
@ -168,6 +169,10 @@ var HelpTopics = map[string]map[string]string{
cli-maintainer
# using the --template flag with the hyperlink helper
gh issue list --json title,url --template '{{range .}}{{hyperlink .url .title}}{{"\n"}}{{end}}'
# adding the --template flag and modifying the display format
$ gh pr list --json number,title,headRefName,updatedAt --template \
'{{range .}}{{tablerow (printf "#%v" .number | autocolor "green") .title .headRefName (timeago .updatedAt)}}{{end}}'