apkovl-cli/cmd/promt-helpers.go
Lukas Bachschwell e01be1ed58
🎉 Initial commit, all commands basically working
Signed-off-by: Lukas Bachschwell <lukas@lbsfilm.at>
2022-01-02 11:53:45 +01:00

50 lines
758 B
Go

package cmd
import (
"errors"
"github.com/manifoldco/promptui"
log "github.com/s00500/env_logger"
)
func promtString(name string) string {
validate := func(input string) error {
if input == "" {
return errors.New("empty string")
}
return nil
}
prompt := promptui.Prompt{
Label: name,
Validate: validate,
}
result, err := prompt.Run()
if err != nil {
log.Fatal(err)
}
return result
}
func promtPassword(name string) string {
validate := func(input string) error {
if input == "" {
return errors.New("empty string")
}
return nil
}
prompt := promptui.Prompt{
Label: name,
Validate: validate,
HideEntered: true,
}
result, err := prompt.Run()
if err != nil {
log.Fatal(err)
}
return result
}