Documentation ¶
Overview ¶
Package prompt contains logic for prompts and user interactions with the CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnterDirectory ¶
EnterDirectory prompts the user to enter the name of the directory they want to save the created template in.
func EnterFileName ¶
EnterFileName prompts the user to enter the name of the file they are going to save a template as, and returns a sanitised.
func SelectDirectory ¶
SelectDirectory prompts the user to select a sub driectory in the provided parent. If the parent directory does not have any subdirectories this will error.
func SelectExistingFile ¶
SelectExistingFile prompt the user to select a file and returns the full path of the selected file.
Types ¶
type SelectorFunc ¶
SelectorFunc is the type def for the selector func used in the TemplateSelector struct.
type TemplateSelector ¶
type TemplateSelector struct {
SelectFunc SelectorFunc
}
TemplateSelector is a utility struct to enable mocking of calls to the survey prompt for easier testability.
func NewTemplateSelector ¶
func NewTemplateSelector() TemplateSelector
NewTemplateSelector creates a new instance of the TemplateSelector struct.
func (TemplateSelector) SelectTemplateWithSubTemplates ¶
func (t TemplateSelector) SelectTemplateWithSubTemplates( templates config.Templates, selectedTemplates []config.Template, ) ([]config.Template, error)
SelectTemplateWithSubTemplates is a recursive function to select template with nested sub templates and return them in a slice so they can all be referenced and the fully nested path to a document can be worked out.