feat: port apply
command from influxdb
(#160)
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/AlecAivazis/survey/v2/terminal"
|
||||
"github.com/mattn/go-isatty"
|
||||
)
|
||||
|
||||
// terminalStdio interacts with the user via an interactive terminal.
|
||||
@ -55,6 +56,10 @@ func (t *terminalStdio) Error(message string) error {
|
||||
return r.Error(&cfg, errors.New(message))
|
||||
}
|
||||
|
||||
func (t *terminalStdio) InputIsInteractive() bool {
|
||||
return isatty.IsTerminal(t.Stdin.Fd()) || isatty.IsCygwinTerminal(t.Stdin.Fd())
|
||||
}
|
||||
|
||||
// GetStringInput prompts the user for arbitrary input.
|
||||
func (t *terminalStdio) GetStringInput(prompt, defaultValue string) (input string, err error) {
|
||||
question := survey.Input{
|
||||
|
@ -9,6 +9,7 @@ type StdIO interface {
|
||||
WriteErr(p []byte) (n int, err error)
|
||||
Banner(message string) error
|
||||
Error(message string) error
|
||||
InputIsInteractive() bool
|
||||
GetStringInput(prompt, defaultValue string) (string, error)
|
||||
GetSecret(prompt string, minLen int) (string, error)
|
||||
GetPassword(prompt string) (string, error)
|
||||
|
Reference in New Issue
Block a user