Skip to content

Conversation

savioxavier
Copy link
Owner

@savioxavier savioxavier commented Jun 12, 2023

Warning
This pull request contains BREAKING CHANGES

Note
This pull request proceeds to a "major" version: v2 v1.3.0


This pull request makes the following changes:

Hyperlink detection

  • Hyperlink detection has been greatly improved
  • New variables and variable checks have been introduced
  • TERM_PROGRAM variable checking is stricter now, with the help of TERM_PROGRAM_VERSION constraints. This is a breaking change
  • Multiple handling functions for environment variable detection such as hasEnv, checkAllEnvs, matchesEnv etc., have been added
  • Version handling is now in a form of a struct called Version. parseVersion now returns this struct of three variables instead of three standalone variables called major, minor, and patch
  • Version scanning now works with version that don't even contain dots
  • os.Getenv() has been replaced with os.LookupEnv()
  • termlink now respects the FORCE_HYPERLINK variable, and forces hyperlinks as long as the variable's value is any of []string{"1", "true", "always", "enabled"}
  • Added support for more terminals including vscode and alacritty (possibly fixes Support alacritty #7)
  • Added support for COLORTERM variable
  • Fixed incorrect version condition for VTE_VERSION

Color Handling

  • colorsList map now has integer values instead of strings
  • Keys have been arranged according to their ANSI escape codes
  • Detecting and adding valid colors from a termlink style color string has been refactored and simplified
  • Colors are initially cleared upon entry to avoid redundant color codes
  • parseColor("reset") has been replaced with an escape code to avoid additional processing

Dependencies

  • fatih/color and jwalton/go-supportscolor have both been removed from the project. Checking for color support is unnecessary because this package only requires checking for basic colors. fatih/color wasn't used in the main termlink code anyways
  • Currently, this package is dependency-free
  • The only dependency is the assert testing library, which is only used for testing purposes and has no effect on main

Documentation

  • godoc comments have been improved
  • README.md has been modified with more code snippets and examples for other utilities such as SupportsHyperlinks and shouldForce

Examples

  • examples/start.go has been improved with more examples and texts

Tests

  • The test that included the fatih/color package has been removed
  • Testing will be revamped in v2.1 v1.3.1 or in a future version (TODO)

savioxavier and others added 24 commits May 22, 2023 13:08
Most terminals support the basic colors anyways, also when ColorLink is used to print hyperlinks, it also assumes colors are also present.
I might have brought this a bit too far
clear colors upon call to delete pre-existing values and use an escape code to reset links
blue color note text thingy
@savioxavier savioxavier merged commit 3afa4f8 into master Jun 12, 2023
@savioxavier savioxavier mentioned this pull request Jun 12, 2023
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.

Support alacritty
1 participant