supports_hyperlinks

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2022 License: MIT Imports: 8 Imported by: 1

README

Fully based in https://github.com/jamestalmage/supports-hyperlinks. Detect whether a terminal emulator supports hyperlinks.

Install

$ go get -u github.com/luisnquin/go-supports-hyperlinks

Usage

package main

import (
	"fmt"
	"os"

	shl "github.com/luisnquin/go-supports-hyperlinks"
)

func main() {
	if shl.Stdout() {
		fmt.Println("Terminal stdout supports hyperlinks")
	}

	if shl.Stderr() {
		fmt.Println("Terminal stderr supports hyperlinks")
	}
	
	if shl.SupportsHyperlinks(os.Stdin) {
		fmt.Println("Terminal stdin supports hyperlinks")
	}
}

Platform support

  • Linux support
  • Darwin support
  • Windows support

Still, read the CLI section if you want to force it on Windows

API

Returns a boolean API indicating whether or not hyperlinks are supported in the current terminal

CLI

Still, you can force the behavior with

$ go run program.go --hyperlink
$ go run program.go --hyperlinks

Otherwise

$ go run program.go --no-hyperlink
$ go run program.go --no-hyperlinks

License

MIT © Luis Quiñones Requelme

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stderr

func Stderr() bool

func Stdout

func Stdout() bool
func SupportsHyperlinks(stream *os.File) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL