-
Notifications
You must be signed in to change notification settings - Fork 422
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
Add hyperlinks for directories in path #668
Conversation
The username may be used as a link toward $HOME. Also, many sensors may be links toward Linux' state file system? Maybe a little bit too much, but kinda fun way to discover the OS internals…
Yes,
Definitely yes. For instance, many terminal emulator have feature allowing to add a term link on text matching a regexp, in order to run any command (I added one to Terminator myself, so as to be able to open a file in my editor at a line/column, just by clicking on a compiler output). Such a feature may come in the way, hence the necessary declutching option.
I would still say enabled by default, or else many users are not going to discover it.
It's difficult to say, but I would tend to see themes as a first step toward finding common modules that would fit as internals. So if it's easy to make a modular and generic feature within the path function (which seems already quite modular, at least I was able to use it in my own theme easily), it's OK to put it in there, else, maybe consider making it a theme first, then see how to make it a common feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome.
Personally, I'd be more interested in github branches linking to the PR opened for that branch - which is probably infeasible. Eg |
Yeah, that much latency is a deal breaker. I think a safe rule is that the prompt should never make a network request. I think we could probably make a few guesses and hardcode some GitHub URL patterns and make it work without network requests, but it would take some work to make it stable. |
I don't think you can, actually - a PR is identified in-url by an id number, which is not the branch name. That mapping would have to be done (AFAIK) server-side. Oh well. |
True. The best we could do is link to a search, like for this PR: But we could always link to the branch, and Github might link to it? https://github.com/nojhan/liquidprompt/tree/feature/url-links Or link to the branch search, which would show a matching PR if it exists: https://github.com/nojhan/liquidprompt/branches/all?query=feature%2Furl-links |
Thinking about that, it may be tricky to have links toward any git-related website, given that not everybody use Github (at least Gitlab is quite a competitor, not even talking about other options). I guess we need to:
|
Exactly, and guessing is all but guaranteed to fail at some point. I could see implementing your second idea with templates, but that would greatly reduce the amount of users that would configure to enable it. |
A compromise would be to provide a default to Github, or to add the most known templates as comments in the shipped preset. |
I implemented something (cherry-picking the aforementioned code to be up-to-date with the current master) on feat+url-links. |
I'm quite loosing track of my work, so if that's OK, I will force-push feat+url-links on this PR (it contains @Rycieos' commit, and this PR was too old to be merged anyway). Then it will be easier to review. |
4278f3c
to
e161ce0
Compare
@Rycieos I cannot assign you a review on a PR you started, but I certainly hope you will request some changes 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't requests changes on my own PR either 😑 But I can submit a review.
Looking pretty good. I need to go over the whole thing again in depth before I can feel confident with it, but these suggestions are at least a start.
As of now, path elements are linked toward |
@Rycieos Probably needs a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request for changes
Sorry for the silence recently; work got busy, and then the holidays.
In general looking good. I want to see a bit better test coverage, since lp_path_format
is so complicated and impossible to understand (sorry).
Ignore the failing jobs, they are fixed with commits c8722f2 and 6c403a0. A rebase would fix the failures.
efd98c5
to
7ce5d14
Compare
@Rycieos: Good for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. One easy tests issue.
This has conflicts with your prompt_comparison file, you will need to rebase to master
to fix those before I can merge.
7ce5d14
to
5e3e916
Compare
@Rycieos Review fixes done and squashed. |
Add a _lp_create_link() function that turns a URL and text into a operating system command sequence for a clickable hyperlink in the terminal. See https://github.com/mintty/mintty/wiki/CtrlSeqs#hyperlinks for details. Add sections of the current path as hyperlinks, with the "file:https://" protocol. Resolves #659
Linking change if we are connected through SSH: - If the connection is SSH: - The hostname links to "ssh:https://<user>@<fqdn>/<path>" - The path elements to "sftp:https://<user>@<fqdn>/<path> - If the connection is su or local: - The path elements to "file:https://<user>@<fqdn>/<path> Use typeset instead of local in tests. Uo-authored-by: Mark Vander Stel <[email protected]>
5e3e916
to
a9b6956
Compare
GG 🍻 |
Add a _lp_create_link() function that turns a URL and text into a operating system command sequence for a clickable hyperlink in the
terminal. See https://github.com/mintty/mintty/wiki/CtrlSeqs#hyperlinks for details.
Add sections of the current path as hyperlinks, with the "file:https://" protocol.
Remaining questions:
ENABLE
config options for each type of link?Resolves #659