Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goreleaser: updates from 1.15.0 #1509

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions completers/goreleaser_completer/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,33 @@ import (
)

var buildCmd = &cobra.Command{
Use: "build",
Short: "Builds the current project",
Run: func(cmd *cobra.Command, args []string) {},
Use: "build",
Short: "Builds the current project",
Aliases: []string{"b"},
Run: func(cmd *cobra.Command, args []string) {},
}

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

buildCmd.Flags().Bool("clean", false, "Remove the dist folder before building")
buildCmd.Flags().StringP("config", "f", "", "Load configuration from file")
buildCmd.Flags().Bool("debug", false, "Enable debug mode")
buildCmd.Flags().BoolP("help", "h", false, "help for build")
buildCmd.Flags().StringP("parallelism", "p", "", "Amount tasks to run concurrently (default 4)")
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().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().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().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 and without publishing any artifacts")
buildCmd.Flags().String("timeout", "", "Timeout to the entire build process (default 30m0s)")
buildCmd.Flags().Bool("snapshot", false, "Generate an unversioned snapshot build, skipping all validations")
buildCmd.Flags().String("timeout", "", "Timeout to the entire build process")
rootCmd.AddCommand(buildCmd)

// TODO build ids
carapace.Gen(buildCmd).FlagCompletion(carapace.ActionMap{
"config": carapace.ActionFiles(),
"output": carapace.ActionFiles(),
})
}
11 changes: 6 additions & 5 deletions completers/goreleaser_completer/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ import (
)

var checkCmd = &cobra.Command{
Use: "check",
Short: "Checks if configuration is valid",
Run: func(cmd *cobra.Command, args []string) {},
Use: "check",
Short: "Checks if configuration is valid",
Aliases: []string{"c"},
Run: func(cmd *cobra.Command, args []string) {},
}

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

checkCmd.Flags().StringP("config", "f", "", "Configuration file to check")
checkCmd.Flags().Bool("debug", false, "Enable debug mode")
checkCmd.Flags().BoolP("help", "h", false, "help for check")
checkCmd.Flags().Bool("deprecated", false, "Force print the deprecation message - tests only")
checkCmd.Flags().BoolP("quiet", "q", false, "Quiet mode: no output")
rootCmd.AddCommand(checkCmd)

carapace.Gen(checkCmd).FlagCompletion(carapace.ActionMap{
Expand Down
11 changes: 5 additions & 6 deletions completers/goreleaser_completer/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import (
)

var initCmd = &cobra.Command{
Use: "init",
Short: "Generates a .goreleaser.yml file",
Run: func(cmd *cobra.Command, args []string) {},
Use: "init",
Short: "Generates a .goreleaser.yaml file",
Aliases: []string{"i"},
Run: func(cmd *cobra.Command, args []string) {},
}

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

initCmd.Flags().StringP("config", "f", "", "Load configuration from file (default \".goreleaser.yml\")")
initCmd.Flags().Bool("debug", false, "Enable debug mode")
initCmd.Flags().BoolP("help", "h", false, "help for init")
initCmd.Flags().StringP("config", "f", ".goreleaser.yaml", "Load configuration from file")
rootCmd.AddCommand(initCmd)

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

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

var jsonschemaCmd = &cobra.Command{
Use: "jsonschema",
Short: "outputs goreleaser's JSON schema",
Aliases: []string{"schema"},
Run: func(cmd *cobra.Command, args []string) {},
}

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

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

carapace.Gen(jsonschemaCmd).FlagCompletion(carapace.ActionMap{
"output": carapace.ActionFiles(),
})
}
43 changes: 29 additions & 14 deletions completers/goreleaser_completer/cmd/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,45 @@ import (
)

var releaseCmd = &cobra.Command{
Use: "release",
Short: "Releases the current project",
Run: func(cmd *cobra.Command, args []string) {},
Use: "release",
Short: "Releases the current project",
Aliases: []string{"r"},
Run: func(cmd *cobra.Command, args []string) {},
}

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

releaseCmd.Flags().Bool("auto-snapshot", false, "Automatically sets --snapshot if the repository is dirty")
releaseCmd.Flags().Bool("clean", false, "Removes the dist folder")
releaseCmd.Flags().StringP("config", "f", "", "Load configuration from file")
releaseCmd.Flags().Bool("debug", false, "Enable debug mode")
releaseCmd.Flags().BoolP("help", "h", false, "help for release")
releaseCmd.Flags().StringP("parallelism", "p", "", "Amount tasks to run concurrently (default 4)")
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().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-notes", "", "Load custom release notes from a markdown file")
releaseCmd.Flags().Bool("rm-dist", false, "Remove the dist folder before building")
releaseCmd.Flags().Bool("skip-publish", false, "Skips publishing artifacts")
releaseCmd.Flags().Bool("skip-sign", false, "Skips signing the artifacts")
releaseCmd.Flags().Bool("skip-validate", false, "Skips several sanity checks")
releaseCmd.Flags().Bool("snapshot", false, "Generate an unversioned snapshot release, skipping all validations and without publishing any artifacts")
releaseCmd.Flags().String("timeout", "", "Timeout to the entire release process (default 30m0s)")
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("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-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")
rootCmd.AddCommand(releaseCmd)

carapace.Gen(releaseCmd).FlagCompletion(carapace.ActionMap{
"config": carapace.ActionFiles(),
"config": carapace.ActionFiles(),
"release-footer": carapace.ActionFiles(),
"release-footer-tmpl": carapace.ActionFiles(),
"release-header": carapace.ActionFiles(),
"release-header-tmpl": carapace.ActionFiles(),
"release-notes": carapace.ActionFiles(),
"release-notes-tmpl": carapace.ActionFiles(),
})
}
1 change: 1 addition & 0 deletions completers/goreleaser_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var rootCmd = &cobra.Command{
func Execute() error {
return rootCmd.Execute()
}

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

Expand Down