diff --git a/format/text/writer.go b/format/text/writer.go index e4da23a..90fd65d 100644 --- a/format/text/writer.go +++ b/format/text/writer.go @@ -9,6 +9,7 @@ import ( "github.com/corvus-ch/horcrux/input" "github.com/martinlindhe/crc24" + "github.com/masterminds/sprig" ) const defaultTemplate = ` @@ -60,6 +61,8 @@ func NewWriter(w io.Writer, f *Format) (io.WriteCloser, error) { t: template.New("text"), } + tw.t.Funcs(sprig.TxtFuncMap()) + if err := tw.parse(); err != nil { return nil, err } diff --git a/go.mod b/go.mod index 3534370..7349112 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/corvus-ch/horcrux require ( + github.com/Masterminds/goutils v1.1.0 // indirect + github.com/Masterminds/semver v1.4.2 // indirect github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect github.com/bketelsen/logr v0.0.0-20170116012416-f3d070bdd1c5 @@ -8,8 +10,12 @@ require ( github.com/corvus-ch/logr v0.0.0-20180917163152-45217966b77e github.com/corvus-ch/shamir v1.0.0 github.com/corvus-ch/zbase32 v1.0.0 + github.com/google/uuid v1.1.1 // indirect github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c + github.com/huandu/xstrings v1.2.0 // indirect + github.com/imdario/mergo v0.3.7 // indirect github.com/martinlindhe/crc24 v0.0.0-20170911183234-2a4d83245616 + github.com/masterminds/sprig v2.18.0+incompatible github.com/pkg/errors v0.8.1 github.com/sebdah/goldie v0.0.0-20180424091453-8784dd1ab561 github.com/stretchr/testify v1.3.0 diff --git a/go.sum b/go.sum index 97726fc..464f1a1 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,7 @@ +github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg= +github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= @@ -14,10 +18,18 @@ github.com/corvus-ch/zbase32 v1.0.0 h1:pDV0qZ1g+HYA8P0PbULsgUg/tZue1FIjsZ7r7h4nZ github.com/corvus-ch/zbase32 v1.0.0/go.mod h1:A7KLRecF1tysURyoqiJBvMJFmt/ccqkRdDTLjlQeVsU= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0= github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= +github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0= +github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= +github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI= +github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/martinlindhe/crc24 v0.0.0-20170911183234-2a4d83245616 h1:tJX0JYmBSy9o9VPtdr1DFjW+AUYdEWmKWA6PM6rWWDU= github.com/martinlindhe/crc24 v0.0.0-20170911183234-2a4d83245616/go.mod h1:2LSPYSdnKs8BnG5rM9jaR70St2Z0b0LJN7GvCGTHUEA= +github.com/masterminds/sprig v2.18.0+incompatible h1:x2CrsC8ZPYlxIC1dxAng4P46a1Fv7hbOJMadfwG7k+k= +github.com/masterminds/sprig v2.18.0+incompatible/go.mod h1:MI10VsRNvEV+FKEkd5Ptqq78DEhmrb3fCBgby33c0oY= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=