mirror of
https://github.com/goreleaser/nfpm
synced 2024-05-08 02:26:18 +02:00
feat(deps): switch back to cobra (#506)
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
b4a2d85284
commit
dcf239f316
4
go.mod
4
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
|
||||
|
|
8
go.sum
8
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=
|
||||
|
|
|
@ -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 ""
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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, " ", " ")
|
||||
|
|
Loading…
Reference in New Issue