Skip to content

feat: add support for printing explicit hyperlinks#12

Open
eugenesvk wants to merge 1 commit intojnoortheen:mainfrom
eugenesvk:hyperlink
Open

feat: add support for printing explicit hyperlinks#12
eugenesvk wants to merge 1 commit intojnoortheen:mainfrom
eugenesvk:hyperlink

Conversation

@eugenesvk
Copy link
Copy Markdown
Contributor

@eugenesvk eugenesvk commented Feb 22, 2023

Allows printing links like print_link 'https://example.com' 'Example Domain' or via the regular import

@eugenesvk eugenesvk force-pushed the hyperlink branch 3 times, most recently from bc80f61 to 44cca48 Compare June 14, 2023 14:36

XSH.env["PROMPT"] = ShellIntegrationPrompt(XSH.env)
if not _skip_alias:
XSH.aliases["print_link"] = utils.write_osc_hyperlink_alias
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

instead of defining it in three modules, can this be put in the module importing others (the entrypoint) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

but then you'd have aliases defined in different places and make the clean loader "dirty"

    if not _skip_alias:
# this remains in the term module ↓
        XSH.aliases["set_wezterm_user_var"] = utils.set_wezterm_user_var_alias
        XSH.aliases["print_link"] = utils.write_osc_hyperlink_alias
# this would move to another file↑

Also what if it turns out they'd need to be slightly different like with set_user_var?

Current encapsulation of all terminal-specific data, including aliases, in a terminal file seems better

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I prefer a DRY solution , can this be placed in its own module and be imported in the loader?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But your suggestion isn't DRY, it trades one form of repetition for another while losing alias colocation: you'll have to repeat loading XONTRIB_TERM_INTEGRATIONS_SKIP_ALIAS and its conditional which each term will have to load to set unique user var aliases

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

yes but loading will be only one time than 3 repeats or potentially any other terminals

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it will be 4 times: 3 times in each terminal file (for user vars aliases), and 1 time in your extra module

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

why not move all aliases to one file then. I don't see any variations in the aliases. Also this PR changes in all three files seems excess.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

why not move all aliases to one file then.

because it doesn't solve any issue. Then you'd also have to repeat which-terminal check in this one file because...

I don't see any variations in the aliases

I've mentioned several times that user var alias name is unique

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I don't see any issue in your code. I just want to minimal change possible. I will work on this PR myself later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants