Skip to content

Commit

Permalink
Extend format command with slim-sprig
Browse files Browse the repository at this point in the history
  • Loading branch information
ffurrer2 committed Dec 29, 2023
1 parent 1ed26a3 commit 55e2cd8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .licenses/go/github.com/go-task/slim-sprig.dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: github.com/go-task/slim-sprig
version: v0.0.0-20230315185526-52ccab3ef572
type: go
summary: Package sprig provides template functions for Go.
homepage: https://pkg.go.dev/github.com/go-task/slim-sprig
license: mit
licenses:
- sources: LICENSE.txt
text: |
Copyright (C) 2013-2020 Masterminds
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
notices: []
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Security

## [2.3.0] - 2023-12-29

### Added

- Extend format command with the [slim-sprig](https://go-task.github.io/slim-sprig/) library

### Changed

- Bumped `alpine` base image from 3.18.4 to 3.19.0
- Updated dependencies

## [2.2.0] - 2023-09-25

### Added
Expand Down
3 changes: 2 additions & 1 deletion cmd/semver/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"text/template"

sprig "github.com/go-task/slim-sprig"
"github.com/spf13/cobra"

"github.com/ffurrer2/semver/v2/internal/pkg/cli"
Expand Down Expand Up @@ -40,7 +41,7 @@ type SemVer struct {
DisableFlagsInUseLine: true,
Run: func(cmd *cobra.Command, args []string) {
text := args[0]
tpl, err := template.New("semver").Parse(text)
tpl, err := template.New("semver").Funcs(sprig.FuncMap()).Parse(text)
if err != nil {
cmd.PrintErrf("error: %v\n", err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21

require (
github.com/go-playground/pkg/v5 v5.22.0
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
github.com/onsi/ginkgo/v2 v2.13.2
github.com/onsi/gomega v1.30.0
github.com/samber/lo v1.39.0
Expand All @@ -13,7 +14,6 @@ require (

require (
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20231229022155-5aaadb5f27d9 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down

0 comments on commit 55e2cd8

Please sign in to comment.