Generates an interactive wizard from prompts in a text/template template file
tmplwizard generates a cli wizard based on prompt functions in a template to allow the user to dynamically provide values.
Prompt Functions:
PromptString
prompts the user for a string value which can be stored in a variable for later use in the template.
PromptBool
allows for conditional rendering of template sections.
Download the latest release from https://github.com/jakewarren/tmplwizard/releases
go get github.com/jakewarren/tmplwizard
Run the included example: go run main.go examples/nested_conditionals.tmpl
examples/nested_conditionals.tmpl:
{{$stringVariable := .PromptString "Enter any string: " -}}
The string you entered ({{$stringVariable}}) is now stored in a variable.
{{ if .PromptBool "Do you want to expand the first section ---> " -}}
This text appears if you confirm the first conditional.
{{ if .PromptBool "Do you want to expand the nested conditional ---> " -}}
This text only appears if you answered yes to both of the previous questions.
{{end -}}
{{end -}}
I created this project as a way to quickly scaffold out text files such as READMEs. There are probably other uses that I'm not thinking of.
All notable changes to this project will be documented in the changelog.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
MIT © 2017 Jake Warren