feat: port apply command from influxdb (#160)

This commit is contained in:
Daniel Moran
2021-06-30 14:47:23 -04:00
committed by GitHub
parent d7b2983dd4
commit a3f36a9821
8 changed files with 1037 additions and 8 deletions

View File

@ -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{