Skip to content

Commit

Permalink
Include non-hermetic text functions from Sprig
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Apr 5, 2020
1 parent 8d538be commit 82f9922
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cmd/config.go
Expand Up @@ -140,7 +140,7 @@ func newConfig(options ...configOption) *Config {
Command: "vimdiff",
},
maxDiffDataSize: 1 * 1024 * 1024, // 1MB
templateFuncs: sprig.HermeticTxtFuncMap(),
templateFuncs: sprig.TxtFuncMap(),
scriptStateBucket: []byte("script"),
Stdin: os.Stdin,
Stdout: os.Stdout,
Expand Down
2 changes: 1 addition & 1 deletion cmd/config_test.go
Expand Up @@ -19,7 +19,7 @@ import (
func TestAutoCommitCommitMessage(t *testing.T) {
commitMessageText, err := getAsset(commitMessageTemplateAsset)
require.NoError(t, err)
commitMessageTmpl, err := template.New("commit_message").Funcs(sprig.HermeticTxtFuncMap()).Parse(string(commitMessageText))
commitMessageTmpl, err := template.New("commit_message").Funcs(sprig.TxtFuncMap()).Parse(string(commitMessageText))
require.NoError(t, err)
for _, tc := range []struct {
name string
Expand Down
9 changes: 4 additions & 5 deletions cmd/docs.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions docs/HOWTO.md
Expand Up @@ -177,9 +177,8 @@ For a full list of variables, run:

For more advanced usage, you can use the full power of the
[`text/template`](https://pkg.go.dev/text/template) language. chezmoi includes
all of the hermetic text functions from
[sprig](http://masterminds.github.io/sprig/) and its own [functions for
interacting with password
all of the text functions from [sprig](http://masterminds.github.io/sprig/) and
its own [functions for interacting with password
managers](https://github.com/twpayne/chezmoi/blob/master/docs/REFERENCE.md#template-functions).

Templates can be executed directly from the command line, without the need to
Expand Down
4 changes: 2 additions & 2 deletions docs/REFERENCE.md
Expand Up @@ -844,8 +844,8 @@ and/or digits.

## Template functions

All standard [`text/template`](https://pkg.go.dev/text/template) and [hermetic
text template functions from `sprig`](http://masterminds.github.io/sprig/) are
All standard [`text/template`](https://pkg.go.dev/text/template) and [text
template functions from `sprig`](http://masterminds.github.io/sprig/) are
included. chezmoi provides some additional functions.

### `bitwarden` [*args*]
Expand Down

0 comments on commit 82f9922

Please sign in to comment.