tty

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 14 Imported by: 0

README

tty tools

  • pretty print for json and go_types
  • terminal raw mode
  • tty color helpers
  • logger for tty

tty

Documentation

Overview

package tty - utilities to work with terminals.

Index

Constants

View Source
const (
	Ldate         = 1 << iota     // the date in the local time zone: 2009/01/23
	Ltime                         // the time in the local time zone: 01:23:23
	Lmicroseconds                 // microsecond resolution: 01:23:23.123123.  assumes Ltime.
	Llongfile                     // full file name and line number: /a/b/c/d.go:23
	Lshortfile                    // final file name element and line number: d.go:23. overrides Llongfile
	LUTC                          // if Ldate or Ltime is set, use UTC rather than the local time zone
	LstdFlags     = Ldate | Ltime // initial values for the standard logger

)
View Source
const (
	Bool        = c.Cyan_h
	Integer     = c.Blue_h
	Float       = c.Magenta_h
	String      = c.Red
	StringQuote = c.Red_h
	EscapedChar = c.Magenta_h
	FieldName   = c.Yellow
	Pointer     = c.Blue_h
	Nil         = c.Cyan_h
	Time        = c.Blue_h
	StructName  = c.Green
	ObjectLen   = c.Blue
)

Variables

View Source
var (
	MaxSlice = 1024
	MaxDepth = -1
	ColSpan  = 0
	TabSize  = 2
	UintHex  = false
)

Functions

func ByJSON

func ByJSON(in []byte)

func Error

func Error(v ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func Fatal

func Fatal(v ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, v ...interface{})

func JSON

func JSON(in []byte) string

func JSONcolor added in v1.2.0

func JSONcolor(in []byte) string

func JSONline added in v1.2.0

func JSONline(in []byte) string

func JSONstr added in v1.1.0

func JSONstr(in string) string

func Note

func Note(v ...interface{})

func Notef

func Notef(format string, v ...interface{})

func OrigMode

func OrigMode()

returns the default mode

func PPrint added in v1.1.0

func PPrint(in interface{})

func PPrintln added in v1.1.0

func PPrintln(v ...interface{})

func PPstr added in v1.1.0

func PPstr(in interface{}) string

func PrJSON added in v1.2.0

func PrJSON(in string)

func Print

func Print(v ...interface{})

func Printf added in v1.1.0

func Printf(format string, v ...interface{})

func Println

func Println(v ...interface{})

func RawMode

func RawMode()

disable input buffering similar exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run() do not display entered characters on the screen similar exec.Command("stty", "-F", "/dev/tty", "-echo").Run()

func SetFlags

func SetFlags(flag int)

log.SetFlags(log.LstdFlags | log.Lshortfile)

func Warn

func Warn(v ...interface{})

func Warnf

func Warnf(format string, v ...interface{})

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