Skip to content

Commit

Permalink
Merge pull request #2106 from rsteube/goreleaser-updates-1.23.0
Browse files Browse the repository at this point in the history
goreleaser: updates from 1.23.0
  • Loading branch information
rsteube authored Jan 3, 2024
2 parents 4f56987 + febf9e1 commit 820c207
Show file tree
Hide file tree
Showing 15 changed files with 175 additions and 25 deletions.
11 changes: 9 additions & 2 deletions completers/goreleaser_completer/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,28 @@ func init() {
buildCmd.Flags().Bool("clean", false, "Remove the dist folder before building")
buildCmd.Flags().StringP("config", "f", "", "Load configuration from file")
buildCmd.Flags().Bool("deprecated", false, "Force print the deprecation message - tests only")
buildCmd.Flags().StringArray("id", []string{}, "Builds only the specified build ids")
buildCmd.Flags().StringSlice("id", []string{}, "Builds only the specified build ids")
buildCmd.Flags().StringP("output", "o", "", "Copy the binary to the path after the build. Only taken into account when using --single-target and a single id (either with --id or if configuration only has one build)")
buildCmd.Flags().IntP("parallelism", "p", 0, "Amount tasks to run concurrently (default: number of CPUs)")
buildCmd.Flags().StringP("parallelism", "p", "", "Amount tasks to run concurrently (default: number of CPUs)")
buildCmd.Flags().Bool("rm-dist", false, "Remove the dist folder before building")
buildCmd.Flags().Bool("single-target", false, "Builds only for current GOOS and GOARCH, regardless of what's set in the configuration file")
buildCmd.Flags().StringSlice("skip", []string{}, "Skip the given options (valid options are: before, post-hooks, pre-hooks, validate)")
buildCmd.Flags().Bool("skip-before", false, "Skips global before hooks")
buildCmd.Flags().Bool("skip-post-hooks", false, "Skips all post-build hooks")
buildCmd.Flags().Bool("skip-validate", false, "Skips several sanity checks")
buildCmd.Flags().Bool("snapshot", false, "Generate an unversioned snapshot build, skipping all validations")
buildCmd.Flags().String("timeout", "", "Timeout to the entire build process")
buildCmd.Flag("deprecated").Hidden = true
buildCmd.Flag("rm-dist").Hidden = true
buildCmd.Flag("skip-before").Hidden = true
buildCmd.Flag("skip-post-hooks").Hidden = true
buildCmd.Flag("skip-validate").Hidden = true
rootCmd.AddCommand(buildCmd)

// TODO build ids
carapace.Gen(buildCmd).FlagCompletion(carapace.ActionMap{
"config": carapace.ActionFiles(),
"output": carapace.ActionFiles(),
"skip": carapace.ActionValues("before", "post-hooks", "pre-hooks", "validate").UniqueList(","),
})
}
6 changes: 4 additions & 2 deletions completers/goreleaser_completer/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var checkCmd = &cobra.Command{
Use: "check",
Use: "check [configuration files]",
Short: "Checks if configuration is valid",
Aliases: []string{"c"},
Run: func(cmd *cobra.Command, args []string) {},
Expand All @@ -15,9 +15,11 @@ var checkCmd = &cobra.Command{
func init() {
carapace.Gen(checkCmd).Standalone()

checkCmd.Flags().StringP("config", "f", "", "Configuration file to check")
checkCmd.Flags().StringP("config", "f", "", "Configuration file(s) to check")
checkCmd.Flags().Bool("deprecated", false, "Force print the deprecation message - tests only")
checkCmd.Flags().BoolP("quiet", "q", false, "Quiet mode: no output")
checkCmd.Flag("config").Hidden = true
checkCmd.Flag("deprecated").Hidden = true
rootCmd.AddCommand(checkCmd)

carapace.Gen(checkCmd).FlagCompletion(carapace.ActionMap{
Expand Down
8 changes: 1 addition & 7 deletions completers/goreleaser_completer/cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ import (

var completionCmd = &cobra.Command{
Use: "completion",
Short: "Print shell autocompletion scripts for goreleaser",
Short: "Generate the autocompletion script for the specified shell",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completionCmd).Standalone()

completionCmd.Flags().Bool("debug", false, "Enable debug mode")
completionCmd.Flags().BoolP("help", "h", false, "help for completion")
rootCmd.AddCommand(completionCmd)

carapace.Gen(completionCmd).PositionalCompletion(
carapace.ActionValues("bash", "fish", "zsh"),
)
}
19 changes: 19 additions & 0 deletions completers/goreleaser_completer/cmd/completion_bash.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_bashCmd = &cobra.Command{
Use: "bash",
Short: "Generate the autocompletion script for bash",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_bashCmd).Standalone()

completion_bashCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions")
completionCmd.AddCommand(completion_bashCmd)
}
19 changes: 19 additions & 0 deletions completers/goreleaser_completer/cmd/completion_fish.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_fishCmd = &cobra.Command{
Use: "fish",
Short: "Generate the autocompletion script for fish",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_fishCmd).Standalone()

completion_fishCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions")
completionCmd.AddCommand(completion_fishCmd)
}
19 changes: 19 additions & 0 deletions completers/goreleaser_completer/cmd/completion_powershell.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_powershellCmd = &cobra.Command{
Use: "powershell",
Short: "Generate the autocompletion script for powershell",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_powershellCmd).Standalone()

completion_powershellCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions")
completionCmd.AddCommand(completion_powershellCmd)
}
19 changes: 19 additions & 0 deletions completers/goreleaser_completer/cmd/completion_zsh.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_zshCmd = &cobra.Command{
Use: "zsh",
Short: "Generate the autocompletion script for zsh",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_zshCmd).Standalone()

completion_zshCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions")
completionCmd.AddCommand(completion_zshCmd)
}
19 changes: 19 additions & 0 deletions completers/goreleaser_completer/cmd/docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var docsCmd = &cobra.Command{
Use: "docs",
Short: "Generates GoReleaser's command line docs",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(docsCmd).Standalone()

rootCmd.AddCommand(docsCmd)
}
21 changes: 21 additions & 0 deletions completers/goreleaser_completer/cmd/generateFigSpec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var generateFigSpecCmd = &cobra.Command{
Use: "generate-fig-spec",
Short: "Generate a fig spec",
Aliases: []string{"generateFigSpec", "genFigSpec"},
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(generateFigSpecCmd).Standalone()

generateFigSpecCmd.Flags().Bool("include-hidden", false, "Include hidden commands in generated Fig autocomplete spec")
rootCmd.AddCommand(generateFigSpecCmd)
}
8 changes: 3 additions & 5 deletions completers/goreleaser_completer/cmd/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ import (
)

var helpCmd = &cobra.Command{
Use: "help",
Use: "help [command]",
Short: "Help about any command",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(helpCmd).Standalone()

helpCmd.Flags().Bool("debug", false, "Enable debug mode")
helpCmd.Flags().BoolP("help", "h", false, "help for help")
rootCmd.AddCommand(helpCmd)

carapace.Gen(helpCmd).PositionalCompletion(
carapace.ActionValues("build", "check", "completion", "init", "release"),
carapace.Gen(helpCmd).PositionalAnyCompletion(
carapace.ActionCommands(rootCmd),
)
}
2 changes: 1 addition & 1 deletion completers/goreleaser_completer/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var initCmd = &cobra.Command{
func init() {
carapace.Gen(initCmd).Standalone()

initCmd.Flags().StringP("config", "f", ".goreleaser.yaml", "Load configuration from file")
initCmd.Flags().StringP("config", "f", "", "Load configuration from file")
rootCmd.AddCommand(initCmd)

carapace.Gen(initCmd).FlagCompletion(carapace.ActionMap{
Expand Down
2 changes: 1 addition & 1 deletion completers/goreleaser_completer/cmd/jsonschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var jsonschemaCmd = &cobra.Command{
func init() {
carapace.Gen(jsonschemaCmd).Standalone()

jsonschemaCmd.Flags().StringP("output", "o", "-", "Where to save the JSONSchema file")
jsonschemaCmd.Flags().StringP("output", "o", "", "Where to save the JSONSchema file")
rootCmd.AddCommand(jsonschemaCmd)

carapace.Gen(jsonschemaCmd).FlagCompletion(carapace.ActionMap{
Expand Down
19 changes: 19 additions & 0 deletions completers/goreleaser_completer/cmd/man.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var manCmd = &cobra.Command{
Use: "man",
Short: "Generates GoReleaser's command line manpages",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(manCmd).Standalone()

rootCmd.AddCommand(manCmd)
}
24 changes: 19 additions & 5 deletions completers/goreleaser_completer/cmd/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,36 @@ func init() {
releaseCmd.Flags().Bool("clean", false, "Removes the dist folder")
releaseCmd.Flags().StringP("config", "f", "", "Load configuration from file")
releaseCmd.Flags().Bool("deprecated", false, "Force print the deprecation message - tests only")
releaseCmd.Flags().IntP("parallelism", "p", 0, "Amount tasks to run concurrently (default: number of CPUs)")
releaseCmd.Flags().Bool("fail-fast", false, "Whether to abort the release publishing on the first error")
releaseCmd.Flags().StringP("parallelism", "p", "", "Amount tasks to run concurrently (default: number of CPUs)")
releaseCmd.Flags().String("release-footer", "", "Load custom release notes footer from a markdown file")
releaseCmd.Flags().String("release-footer-tmpl", "", "Load custom release notes footer from a templated markdown file (overrides --release-footer)")
releaseCmd.Flags().String("release-header", "", "Load custom release notes header from a markdown file")
releaseCmd.Flags().String("release-header-tmpl", "", "Load custom release notes header from a templated markdown file (overrides --release-header)")
releaseCmd.Flags().String("release-notes", "", "Load custom release notes from a markdown file (will skip GoReleaser changelog generation)")
releaseCmd.Flags().String("release-notes-tmpl", "", "Load custom release notes from a templated markdown file (overrides --release-notes)")
releaseCmd.Flags().Bool("skip-announce", false, "Skips announcing releases (implies --skip-validate)")
releaseCmd.Flags().Bool("rm-dist", false, "Removes the dist folder")
releaseCmd.Flags().StringSlice("skip", []string{}, "Skip the given options (valid options are announce, aur, before, docker, homebrew, ko, nix, publish, sbom, scoop, sign, snapcraft, validate, winget)")
releaseCmd.Flags().Bool("skip-announce", false, "Skips announcing releases (implies --skip=validate)")
releaseCmd.Flags().Bool("skip-before", false, "Skips global before hooks")
releaseCmd.Flags().Bool("skip-docker", false, "Skips Docker Images/Manifests builds")
releaseCmd.Flags().Bool("skip-ko", false, "Skips Ko builds")
releaseCmd.Flags().Bool("skip-publish", false, "Skips publishing artifacts (implies --skip-announce)")
releaseCmd.Flags().Bool("skip-publish", false, "Skips publishing artifacts (implies --skip=announce)")
releaseCmd.Flags().Bool("skip-sbom", false, "Skips cataloging artifacts")
releaseCmd.Flags().Bool("skip-sign", false, "Skips signing artifacts")
releaseCmd.Flags().Bool("skip-validate", false, "Skips git checks")
releaseCmd.Flags().Bool("snapshot", false, "Generate an unversioned snapshot release, skipping all validations and without publishing any artifacts (implies --skip-publish, --skip-announce and --skip-validate)")
releaseCmd.Flags().Duration("timeout", 0, "Timeout to the entire release process")
releaseCmd.Flags().Bool("snapshot", false, "Generate an unversioned snapshot release, skipping all validations and without publishing any artifacts (implies --skip=announce,publish,validate)")
releaseCmd.Flags().String("timeout", "", "Timeout to the entire release process")
releaseCmd.Flag("deprecated").Hidden = true
releaseCmd.Flag("rm-dist").Hidden = true
releaseCmd.Flag("skip-announce").Hidden = true
releaseCmd.Flag("skip-before").Hidden = true
releaseCmd.Flag("skip-docker").Hidden = true
releaseCmd.Flag("skip-ko").Hidden = true
releaseCmd.Flag("skip-publish").Hidden = true
releaseCmd.Flag("skip-sbom").Hidden = true
releaseCmd.Flag("skip-sign").Hidden = true
releaseCmd.Flag("skip-validate").Hidden = true
rootCmd.AddCommand(releaseCmd)

carapace.Gen(releaseCmd).FlagCompletion(carapace.ActionMap{
Expand All @@ -46,5 +59,6 @@ func init() {
"release-header-tmpl": carapace.ActionFiles(),
"release-notes": carapace.ActionFiles(),
"release-notes-tmpl": carapace.ActionFiles(),
"skip": carapace.ActionValues("announce", "aur", "before", "docker", "homebrew", "ko", "nix", "publish", "sbom", "scoop", "sign", "snapcraft", "validate", "winget").UniqueList(","),
})
}
4 changes: 2 additions & 2 deletions completers/goreleaser_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Execute() error {
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().Bool("debug", false, "Enable debug mode")
rootCmd.Flags().BoolP("help", "h", false, "help for goreleaser")
rootCmd.PersistentFlags().Bool("debug", false, "Enable verbose mode")
rootCmd.PersistentFlags().Bool("verbose", false, "Enable verbose mode")
rootCmd.Flags().BoolP("version", "v", false, "version for goreleaser")
}

0 comments on commit 820c207

Please sign in to comment.