doc.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. Package term provides a portable interface for terminal I/O.
  3. It manages input and output (I/O) for character-mode applications.
  4. The high-level functions enable an application to read from standard input to
  5. retrieve keyboard input stored in a terminal's input buffer. They also enable
  6. an application to write to standard output or standard error to display text
  7. in the terminal's screen buffer. And they also support redirection of standard
  8. handles and control of terminal modes for different I/O functionality.
  9. The low-level functions enable applications to receive detailed input about
  10. keyboard. They also enable greater control of output to the screen.
  11. Usage:
  12. ter, err := term.New()
  13. if err != nil {
  14. panic(err)
  15. }
  16. defer func() {
  17. if err = ter.Restore(); err != nil {
  18. // Handle error
  19. }
  20. }()
  21. Important
  22. The "go test" tool runs tests with standard input connected to standard
  23. error. So whatever program that uses the file descriptor of "/dev/stdin"
  24. (which is 0), then it is going to fail. The solution is to use the standard
  25. error.
  26. */
  27. package term