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
feat: Add link
ansi wrapper
#462
Comments
link
ansi wrapperlink
ansi wrapper
@felangel would you accept a PR for this feature? If so, feel free to assign to me |
Yes, I'd love to add this 👍 |
I don't think using I like to propose a top-level function The top-level function // "wraps" given string with a link, then returns the value
String linkWrap(String message, Uri uri) { ... }
void main() {
final logger = Logger(level: Level.verbose);
final issuesLink = linkWrap(
'see issues here',
Uri.parse('https://github.com/felangel/mason/issues/'),
);
logger
..info(issuesLink)
..warn(issuesLink)
..err(issuesLink);
} class Logger {
void link(
String message,
Uri uri, [
void Function(String)? write, // uses [info] by default
]) { ... }
}
void main() {
final logger = Logger(level: Level.verbose);
final issuesUri = Uri.parse('https://github.com/felangel/mason/issues/');
logger
..link('see issues here', issuesUri)
..link('see issues here', issuesUri, logger.err)
..link('see issues here', issuesUri, logger.warn);
} Woth implementations would be identical in output: Personally I like |
…#462) Bumps [eslint](https://github.com/eslint/eslint) from 8.30.0 to 8.31.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](eslint/eslint@v8.30.0...v8.31.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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
Additional Context
An example API:
The text was updated successfully, but these errors were encountered: