diff --git a/go.mod b/go.mod index c67c910..f1ea697 100644 --- a/go.mod +++ b/go.mod @@ -15,9 +15,9 @@ require ( github.com/goreleaser/fileglob v1.3.0 github.com/imdario/mergo v0.3.12 github.com/klauspost/pgzip v1.2.5 - github.com/muesli/coral v1.0.0 - github.com/muesli/mango-coral v1.0.1 + github.com/muesli/mango-cobra v1.1.0 github.com/muesli/roff v0.1.0 + github.com/spf13/cobra v1.4.0 github.com/stretchr/testify v1.7.1 github.com/ulikunitz/xz v0.5.10 github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 diff --git a/go.sum b/go.sum index 8a2075d..1121a39 100644 --- a/go.sum +++ b/go.sum @@ -237,12 +237,10 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/muesli/coral v1.0.0 h1:odyqkoEg4aJAINOzvnjN4tUsdp+Zleccs7tRIAkkYzU= -github.com/muesli/coral v1.0.0/go.mod h1:bf91M/dkp7iHQw73HOoR9PekdTJMTD6ihJgWoDitde8= github.com/muesli/mango v0.1.0 h1:DZQK45d2gGbql1arsYA4vfg4d7I9Hfx5rX/GCmzsAvI= github.com/muesli/mango v0.1.0/go.mod h1:5XFpbC8jY5UUv89YQciiXNlbi+iJgt29VDC5xbzrLL4= -github.com/muesli/mango-coral v1.0.1 h1:W3nGbUC/q5vLscQ6GPzteHZrJI1Msjw5Hns82o0xRkI= -github.com/muesli/mango-coral v1.0.1/go.mod h1:EPSlYH67AtcxQrxssNw6r/lMFxHTjuDoGfq9Uxxevhg= +github.com/muesli/mango-cobra v1.1.0 h1:j/mM5omhC2Vw8pim716aMJVElIRln089XZJ2JY7Xjzc= +github.com/muesli/mango-cobra v1.1.0/go.mod h1:lotV+49eKrAV0tTw/ONhLsiyKwM5uW5QP2OkYw4xlNc= github.com/muesli/mango-pflag v0.1.0 h1:UADqbYgpUyRoBja3g6LUL+3LErjpsOwaC9ywvBWe7Sg= github.com/muesli/mango-pflag v0.1.0/go.mod h1:YEQomTxaCUp8PrbhFh10UfbhbQrM/xJ4i2PB8VTLLW0= github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8= @@ -295,6 +293,8 @@ github.com/spf13/afero v1.4.1/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= diff --git a/internal/cmd/docs.go b/internal/cmd/docs.go index ed8d135..64cd516 100644 --- a/internal/cmd/docs.go +++ b/internal/cmd/docs.go @@ -3,24 +3,24 @@ package cmd import ( "strings" - "github.com/muesli/coral" - "github.com/muesli/coral/doc" + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" ) type docsCmd struct { - cmd *coral.Command + cmd *cobra.Command } func newDocsCmd() *docsCmd { root := &docsCmd{} - cmd := &coral.Command{ + cmd := &cobra.Command{ Use: "docs", Short: "Generates nFPM's command line docs", SilenceUsage: true, DisableFlagsInUseLine: true, Hidden: true, - Args: coral.NoArgs, - RunE: func(cmd *coral.Command, args []string) error { + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { root.cmd.Root().DisableAutoGenTag = true return doc.GenMarkdownTreeCustom(root.cmd.Root(), "www/docs/cmd", func(_ string) string { return "" diff --git a/internal/cmd/init.go b/internal/cmd/init.go index 4c74748..c32d144 100644 --- a/internal/cmd/init.go +++ b/internal/cmd/init.go @@ -4,24 +4,24 @@ import ( "fmt" "os" - "github.com/muesli/coral" + "github.com/spf13/cobra" ) type initCmd struct { - cmd *coral.Command + cmd *cobra.Command config string } func newInitCmd() *initCmd { root := &initCmd{} - cmd := &coral.Command{ + cmd := &cobra.Command{ Use: "init", Aliases: []string{"i"}, Short: "Creates a sample nfpm.yaml config file", SilenceUsage: true, SilenceErrors: true, - Args: coral.NoArgs, - RunE: func(cmd *coral.Command, args []string) error { + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { if err := os.WriteFile(root.config, []byte(example), 0o666); err != nil { return fmt.Errorf("failed to create example file: %w", err) } diff --git a/internal/cmd/man.go b/internal/cmd/man.go index 1967bed..09768f1 100644 --- a/internal/cmd/man.go +++ b/internal/cmd/man.go @@ -4,26 +4,26 @@ import ( "fmt" "os" - "github.com/muesli/coral" - mcoral "github.com/muesli/mango-coral" + mcobra "github.com/muesli/mango-cobra" "github.com/muesli/roff" + "github.com/spf13/cobra" ) type manCmd struct { - cmd *coral.Command + cmd *cobra.Command } func newManCmd() *manCmd { root := &manCmd{} - cmd := &coral.Command{ + cmd := &cobra.Command{ Use: "man", Short: "Generates nfpm's command line manpages", SilenceUsage: true, DisableFlagsInUseLine: true, Hidden: true, - Args: coral.NoArgs, - RunE: func(cmd *coral.Command, args []string) error { - manPage, err := mcoral.NewManPage(1, root.cmd.Root()) + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + manPage, err := mcobra.NewManPage(1, root.cmd.Root()) if err != nil { return err } diff --git a/internal/cmd/package.go b/internal/cmd/package.go index d7c70d2..2dd73f4 100644 --- a/internal/cmd/package.go +++ b/internal/cmd/package.go @@ -8,11 +8,11 @@ import ( "path/filepath" "github.com/goreleaser/nfpm/v2" - "github.com/muesli/coral" + "github.com/spf13/cobra" ) type packageCmd struct { - cmd *coral.Command + cmd *cobra.Command config string target string packager string @@ -20,14 +20,14 @@ type packageCmd struct { func newPackageCmd() *packageCmd { root := &packageCmd{} - cmd := &coral.Command{ + cmd := &cobra.Command{ Use: "package", Aliases: []string{"pkg", "p"}, Short: "Creates a package based on the given the given config file and flags", SilenceUsage: true, SilenceErrors: true, - Args: coral.NoArgs, - RunE: func(cmd *coral.Command, args []string) error { + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { return doPackage(root.config, root.target, root.packager) }, } diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 36b6aca..92bb8fe 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -6,7 +6,7 @@ import ( _ "github.com/goreleaser/nfpm/v2/apk" _ "github.com/goreleaser/nfpm/v2/deb" _ "github.com/goreleaser/nfpm/v2/rpm" - "github.com/muesli/coral" + "github.com/spf13/cobra" ) func Execute(version string, exit func(int), args []string) { @@ -14,7 +14,7 @@ func Execute(version string, exit func(int), args []string) { } type rootCmd struct { - cmd *coral.Command + cmd *cobra.Command exit func(int) } @@ -31,14 +31,14 @@ func newRootCmd(version string, exit func(int)) *rootCmd { root := &rootCmd{ exit: exit, } - cmd := &coral.Command{ + cmd := &cobra.Command{ Use: "nfpm", Short: "Packages apps on RPM, Deb and APK formats based on a YAML configuration file", Long: `nFPM is a simple, 0-dependencies, deb, rpm and apk packager.`, Version: version, SilenceUsage: true, SilenceErrors: true, - Args: coral.NoArgs, + Args: cobra.NoArgs, } cmd.AddCommand( diff --git a/internal/cmd/schema.go b/internal/cmd/schema.go index df6cb4b..268f2f7 100644 --- a/internal/cmd/schema.go +++ b/internal/cmd/schema.go @@ -8,24 +8,24 @@ import ( "github.com/alecthomas/jsonschema" "github.com/goreleaser/nfpm/v2" - "github.com/muesli/coral" + "github.com/spf13/cobra" ) type schemaCmd struct { - cmd *coral.Command + cmd *cobra.Command output string } func newSchemaCmd() *schemaCmd { root := &schemaCmd{} - cmd := &coral.Command{ + cmd := &cobra.Command{ Use: "jsonschema", Aliases: []string{"schema"}, Short: "Outputs nFPM's JSON schema", SilenceUsage: true, SilenceErrors: true, - Args: coral.NoArgs, - RunE: func(cmd *coral.Command, args []string) error { + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { schema := jsonschema.Reflect(&nfpm.Config{}) schema.Description = "nFPM configuration definition file" bts, err := json.MarshalIndent(schema, " ", " ")