Skip to content

Commit

Permalink
chore(cmd): Use go-utils func for versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Nov 11, 2024
1 parent 97430d4 commit 9dc4157
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 68 deletions.
4 changes: 2 additions & 2 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"path/filepath"
"strings"

"gabe565.com/utils/cobrax"
"gabe565.com/utils/coloryaml"
"github.com/clevyr/yampl/internal/config"
"github.com/clevyr/yampl/internal/util"
Expand All @@ -26,7 +27,7 @@ YAML data can be piped to stdin or files/dirs can be passed as arguments.
Full reference at ` + termenv.Hyperlink("https://github.com/clevyr/yampl#readme", "github.com/clevyr/yampl")

func New(opts ...Option) *cobra.Command {
func New(opts ...cobrax.Option) *cobra.Command {
cmd := &cobra.Command{
Use: "yampl [files | dirs] [-v key=value...]",
Short: "Inline YAML templating via line-comments",
Expand All @@ -44,7 +45,6 @@ func New(opts ...Option) *cobra.Command {
for _, opt := range opts {
opt(cmd)
}

return cmd
}

Expand Down
12 changes: 0 additions & 12 deletions cmd/options.go

This file was deleted.

32 changes: 0 additions & 32 deletions cmd/version.go

This file was deleted.

12 changes: 0 additions & 12 deletions cmd/version_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/clevyr/yampl
go 1.23.2

require (
gabe565.com/utils v0.0.0-20241029174609-934fb3acf91e
gabe565.com/utils v0.0.0-20241111053222-0f59399cbb3c
github.com/Masterminds/sprig/v3 v3.3.0
github.com/dmarkham/enumer v1.5.10
github.com/lmittmann/tint v1.0.5
Expand All @@ -23,7 +23,7 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/goccy/go-yaml v1.13.0 // indirect
github.com/goccy/go-yaml v1.13.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
gabe565.com/utils v0.0.0-20241029174609-934fb3acf91e h1:UP9HzqvfJI8n6k2XIBe95pixGA36wFx3JiVbPa8RFJE=
gabe565.com/utils v0.0.0-20241029174609-934fb3acf91e/go.mod h1:i93PnuU9qG5dNr79l+206DXeYn+E6r7FrqNGSLhjrvw=
gabe565.com/utils v0.0.0-20241111053222-0f59399cbb3c h1:xKxZ9fGvYYihnqbyt1OE5Giz+rDQf5junHUxmvkFBfw=
gabe565.com/utils v0.0.0-20241111053222-0f59399cbb3c/go.mod h1:ekV9VNVFXI1E8niHsgfb76RQHP2oJH2zYaCw1cEWrhA=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
Expand All @@ -12,8 +12,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.23 h1:4M6+isWdcStXEf15G/RbrMPOQj1dZ7HPZCGwE4kOeP0=
github.com/creack/pty v1.1.23/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dmarkham/enumer v1.5.10 h1:ygL0L6quiTiH1jpp68DyvsWaea6MaZLZrTTkIS++R0M=
Expand All @@ -22,8 +22,8 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/goccy/go-yaml v1.13.0 h1:0Wtp0FZLd7Sm8gERmR9S6Iczzb3vItJj7NaHmFg8pTs=
github.com/goccy/go-yaml v1.13.0/go.mod h1:IjYwxUiJDoqpx2RmbdjMUceGHZwYLon3sfOGl5Hi9lc=
github.com/goccy/go-yaml v1.13.7 h1:5k2i973KptPV1mur30XMXwGepDmskip4gA2zHWzWmOY=
github.com/goccy/go-yaml v1.13.7/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
Expand Down
3 changes: 2 additions & 1 deletion internal/generate/docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"strings"

"gabe565.com/utils/cobrax"
"github.com/clevyr/yampl/cmd"
"github.com/spf13/cobra/doc"
)
Expand All @@ -21,7 +22,7 @@ func main() {
log.Fatalf("failed to mkdir: %v", err)
}

rootCmd := cmd.New(cmd.WithVersion("beta"))
rootCmd := cmd.New(cobrax.WithVersion("beta"))
if i := strings.Index(rootCmd.Long, "\n\nFull reference at"); i != -1 {
rootCmd.Long = rootCmd.Long[:i]
}
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log/slog"
"os"

"gabe565.com/utils/cobrax"
"github.com/clevyr/yampl/cmd"
"github.com/clevyr/yampl/internal/config"
)
Expand All @@ -12,7 +13,7 @@ var version = "beta"

func main() {
config.InitLog(os.Stderr, slog.LevelInfo, config.FormatAuto)
root := cmd.New(cmd.WithVersion(version))
root := cmd.New(cobrax.WithVersion(version))
if err := root.Execute(); err != nil {
os.Exit(1)
}
Expand Down

0 comments on commit 9dc4157

Please sign in to comment.