utils

package
v0.0.0-...-90ceb82 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskAndAnswerCustomSelect

func AskAndAnswerCustomSelect(title string, list []SelectItem) (string, error)

AskAndAnswerCustomSelect will ask a custom select question and return the selected answer as a string

func AskForProvider

func AskForProvider() (string, error)

AskForProvider will ask the user which provider they would like to use returns the selected provider as a string

func CreateCustomSelectPrompt

func CreateCustomSelectPrompt(title string, completeList []SelectItem) promptui.Select

CreateCustomSelectPrompt will create a customised formatted select prompt to be used to ask the user a multi-select question

func GetAnswerFromCustomPrompt

func GetAnswerFromCustomPrompt(prompt promptui.Select, list []SelectItem) (string, error)

GetAnswerFromCustomPrompt will take in a select prompt (usually custom), a list of items returns the selected answer as a string

func ValidateAreYouSure

func ValidateAreYouSure(input string) error

ValidateAreYouSure will check whether they entered yes

func ValidateDropletName

func ValidateDropletName(input string) error

ValidateDropletName will check whether they entered a valid droplet name

Types

type SelectItem

type SelectItem struct {
	Name  string
	Value string
}

SelectItem is used for custom selects

func ParseDropletListResults

func ParseDropletListResults(list []godo.Droplet) []SelectItem

ParseDropletListResults will return a list of DigitalOcean ssh keys as SelectItems to be used for promptui

func ParseImageListResults

func ParseImageListResults(list []godo.Image) []SelectItem

ParseImageListResults will return a list of DigitalOcean images as SelectItems to be used for promptui

func ParseRegionListresults

func ParseRegionListresults(list []godo.Region) []SelectItem

ParseRegionListresults will return a list of DigitalOcean regions as SelectItems to be used for promptui

func ParseSSHKeyListResults

func ParseSSHKeyListResults(list []godo.Key) []SelectItem

ParseSSHKeyListResults will return a list of DigitalOcean ssh keys as SelectItems to be used for promptui

func ParseSizeListResults

func ParseSizeListResults(list []godo.Size) []SelectItem

ParseSizeListResults will return a list of DigitalOcean sizes as SelectItems to be used for promptui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL