File: envcheck.go

package info (click to toggle)
golang-github-gookit-color 1.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,708 kB
  • sloc: sh: 101; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 838 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"fmt"
	"os"
	"runtime"
	"strconv"

	"github.com/gookit/color"
	// "github.com/gookit/goutil/dump"
)

// go run ./_examples/envcheck.go
// COLOR_DEBUG_MODE=on go run ./_examples/envcheck.go
func main() {
	fmt.Println("current OS:", runtime.GOOS)

	fmt.Println("Terminal Color Level:", color.TermColorLevel())
	fmt.Println("Support Basic Color:", color.SupportColor())
	fmt.Println("Support 256 Color:", color.Support256Color())
	fmt.Println("Support True Color:", color.SupportTrueColor())

	if es := color.InnerErrs(); len(es) > 0 {
		fmt.Println("inner errors:", es)
	}

	termVal := os.Getenv("TERM")
	fmt.Println("----------------TERM value is:", termVal, "---------------")
	fmt.Println(
		termVal[0:1],
		strconv.FormatUint(uint64(termVal[0]), 16),
	)

	// dump.P(os.Environ())
	// fmt.Println(os.Environ())
}