mason
mason copied to clipboard
feat: Add `link` ansi wrapper
Description
Add an ANSI wrapper that enables hyperlinks/links in the terminal. More info at this Gist on how to achieve the desired effect.
I've done this in one of my projects, but I think it might server others as well.
Requirements
- [ ] API to "wrap" a string with a link for stdout.
Additional Context
An example API:
Future<void> main() async {
Logger(level: Level.verbose).info(
linkWrap(
'You can find issues here',
'https://github.com/felangel/mason/issues/',
),
);
}
String linkWrap(String message, String link) {
final uri = '\x1B]8;;$link\x1B\\';
final text = '$message\x1B]8;;\x1B\\';
return '$uri$text';
}
![hyperlink](https://user-images.githubusercontent.com/38171761/179578392-363ea2f2-6484-43f9-bd53-a18ad2373708.png)