🎉 Initial commit, all commands basically working
Signed-off-by: Lukas Bachschwell <lukas@lbsfilm.at>
This commit is contained in:
49
cmd/promt-helpers.go
Normal file
49
cmd/promt-helpers.go
Normal file
@ -0,0 +1,49 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user