-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NFC] Add circt copy of upstream's linkify. (#7521)
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
# This script linkifies (i.e. makes clickable in the terminal) text that appears | ||
# to be a pull request or issue reference (e.g. #12345 or PR12345) or a | ||
# 40-character commit hash (e.g. abc123). You can configure git to automatically | ||
# send the output of commands that pipe their output through a pager, such as | ||
# `git log` and `git show`, through this script by running this command from | ||
# within your CIRCT checkout: | ||
# | ||
# git config core.pager 'utils/linkify.sh | pager' | ||
# | ||
# Consider: | ||
# | ||
# git config core.pager 'utils/linkify.sh | ${PAGER:-less}' | ||
# | ||
# The pager command is run from the root of the repository even if the git | ||
# command is run from a subdirectory, so the relative path should always work. | ||
# | ||
# It requires OSC 8 support in the terminal. For a list of compatible terminals, | ||
# see https://github.com/Alhadis/OSC8-Adoption | ||
# | ||
# Copied from upstream LLVM's llvm/utils/git/linkify. | ||
|
||
sed \ | ||
-e 's,\(#\|\bPR\)\([0-9]\+\),\x1b]8;;https://github.com/llvm/circt/issues/\2\x1b\\\0\x1b]8;;\x1b\\,gi' \ | ||
-e 's,[0-9a-f]\{40\},\x1b]8;;https://github.com/llvm/circt/commit/\0\x1b\\\0\x1b]8;;\x1b\\,g' |