Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clickable links in opam show #4568

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Feb 26, 2021

A piece of sleeplessness-induced silliness looking at #4565 - if a field in opam show parses as a URL, turn the field marker into a clickable hyperlink.

Not for 2.1 (if at all, but the function might be useful, even if not used in opam show)

Allows generation of OSC 8 sequences for clickable hyperlinks.
try
let basic_contents = detail_printer ~prettify:true ?normalise ~sort st nv item in
let contents_url = OpamUrl.parse basic_contents in
if OpamUrl.(contents_url.transport = "http" || contents_url.transport = "https") then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A reason to not use the backend field ?

@@ -442,6 +442,12 @@ let carriage_delete =
else
carriage_delete_unix

let url ~ref ~label =
if not (color ()) || Sys.win32 && get_win32_console_shim `stdout Mode = Shim then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth a comment linking to the handy https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda which describes the escape codes for Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: WIP Not for merge at this stage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants