Documentation
¶
Index ¶
- func MaxBools(one, two bool) bool
- func ModSlugToString(mod string) (string, error)
- func ModStringToSlug(mod string) (string, error)
- func NewFile(path *string, content string) error
- func OverwriteFile(path string, data string) error
- func Parse(target string, opts ParseOptions) (*ast.Puppetfile, error)
- func ParseFile(path string) (*ast.Puppetfile, error)
- func PromptConfirmFile(path, data string, confirm bool) error
- func PromptForInput(prompt string) string
- func PromptNew(path, data string, confirm bool) error
- func PromptOverwrite(path, data string, confirm bool) error
- func ValidatePath(path string) error
- type ParseOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxBools ¶
MaxBools takes two bools and returns the max "truthiness". I.E. if bool1 is false and bool2 is true, return true. The only time this function returns false is when both bools are false.
func ModSlugToString ¶
ModSlugToString converts a module slug "<org>-<module>" to a string "<org>/<module>"
func ModStringToSlug ¶
ModStringToSlug converts a module string "<org>/<module> to a slug "<org>-<module>".
func NewFile ¶
NewFile writes given data to a new file at the given path. The function should only be used for creating new files as it does not care if there is a file at the target path already and will not attempt to recover the original file in the event that an error occurs during the write process.
func OverwriteFile ¶
OverwriteFile writes given data to the given file that exists already. The function attempts to recover the original file if an error occurs during the write process.
func Parse ¶
func Parse(target string, opts ParseOptions) (*ast.Puppetfile, error)
Parse parses a Puppetfile from either a Git source or a file on disk
func ParseFile ¶
func ParseFile(path string) (*ast.Puppetfile, error)
ParseFile reads a file and parses it using the Puppetfile AST
func PromptConfirmFile ¶
PromptConfirmFile is used with the out-file or write-in-place flags and wraps appropriate user confirmation prompts. If confirm is true, the user prompts are bypassed.
func PromptForInput ¶
PromptForInput prompts a user to enter input in the terminal and returns their input as a string
func PromptNew ¶
PromptNew is a wrapper for the OutFile function that gives the user a confirmation prompt before writing.
func PromptOverwrite ¶
PromptOverwrite is a wrapper for the WriteInPlace function that gives the user a confirmation prompt before writing.
func ValidatePath ¶
ValidatePath checks that the file at the given path is a regular file