diff options
| author | Joe Richey joerichey@google.com <joerichey@google.com> | 2017-10-17 02:39:07 -0700 |
|---|---|---|
| committer | Joseph Richey <joerichey94@gmail.com> | 2017-10-19 02:22:26 -0700 |
| commit | bab7dfdf68075b345e4de3ae79ea685ca884668f (patch) | |
| tree | eced4ecdfd37aae1a92f28ba0864837db1205eb0 /cmd/format.go | |
| parent | b5cc60b2b974645f0d09721c292cd243d049cbcf (diff) | |
Move around and fscrypt refactor
Diffstat (limited to 'cmd/format.go')
| -rw-r--r-- | cmd/format.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cmd/format.go b/cmd/format.go index 69fd0e9..877938c 100644 --- a/cmd/format.go +++ b/cmd/format.go @@ -69,11 +69,11 @@ func init() { } } -// Takes an input string text, and wraps the text so that each line begins with -// numTabs tabs (except the first line) and ends with a newline (except the last -// line), and each line has length less than lineLength. If the text contains a -// word which is too long, that word gets its own line. -func wrapText(text string, numTabs int) string { +// WrapText wraps an input string so that each line begins with numTabs tabs +// (except the first line) and ends with a newline (except the last line), and +// each line has length less than lineLength. If the text contains a word which +// is too long, that word gets its own line. +func WrapText(text string, numTabs int) string { // We use a buffer to format the wrapped text so we get O(n) runtime var buffer bytes.Buffer spaceLeft := 0 @@ -168,7 +168,7 @@ func AskConfirmation(question, warning string, defaultChoice bool) error { } if warning != "" { - fmt.Fprintln(Output, wrapText("WARNING: "+warning, 0)) + fmt.Fprintln(Output, WrapText("WARNING: "+warning, 0)) } confirmed, err := AskQuestion(question, defaultChoice) @@ -185,7 +185,7 @@ func AskConfirmation(question, warning string, defaultChoice bool) error { // the provided Context and writer. Panics if text cannot be executed. func ExecuteTemplate(w io.Writer, text string, ctx *Context) { tmpl := template.Must(template.New("").Funcs(template.FuncMap{ - "wrapText": wrapText, + "WrapText": WrapText, }).Parse(text)) if err := tmpl.Execute(w, ctx); err != nil { panic(err) |