|
| 1 | +// Copyright 2019 The Go Authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style |
| 3 | +// license that can be found in the LICENSE file. |
| 4 | + |
| 5 | +package term |
| 6 | + |
| 7 | +import ( |
| 8 | + "fmt" |
| 9 | + "runtime" |
| 10 | +) |
| 11 | + |
| 12 | +type State struct{} |
| 13 | + |
| 14 | +func isTerminal(fd int) bool { |
| 15 | + return false |
| 16 | +} |
| 17 | + |
| 18 | +// MakeRaw put the terminal connected to the given file descriptor into raw |
| 19 | +// mode and returns the previous state of the terminal so that it can be |
| 20 | +// restored. |
| 21 | +func MakeRaw(fd int) (*State, error) { |
| 22 | + return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) |
| 23 | +} |
| 24 | + |
| 25 | +// GetState returns the current state of a terminal which may be useful to |
| 26 | +// restore the terminal after a signal. |
| 27 | +func GetState(fd int) (*State, error) { |
| 28 | + return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) |
| 29 | +} |
| 30 | + |
| 31 | +// Restore restores the terminal connected to the given file descriptor to a |
| 32 | +// previous state. |
| 33 | +func Restore(fd int, state *State) error { |
| 34 | + return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) |
| 35 | +} |
| 36 | + |
| 37 | +// GetSize returns the dimensions of the given terminal. |
| 38 | +func GetSize(fd int) (width, height int, err error) { |
| 39 | + return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) |
| 40 | +} |
| 41 | + |
| 42 | +// ReadPassword reads a line of input from a terminal without local echo. This |
| 43 | +// is commonly used for inputting passwords and other sensitive data. The slice |
| 44 | +// returned does not include the \n. |
| 45 | +func ReadPassword(fd int) ([]byte, error) { |
| 46 | + return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) |
| 47 | +} |
0 commit comments