mirror of
https://github.com/mudler/luet.git
synced 2025-09-22 19:48:27 +00:00
Use goreleaser to build and release (#244)
Instead of using gox on one side and an action to release, we can merge them together with goreleaser which will build for extra targets (arm, mips if needed in the future) and it also takes care of creating checksums, a source archive, and a changelog and creating a release with all the artifacts. All binaries should respect the old naming convention, so any scripts out there should still work. Signed-off-by: Itxaka <igarcia@suse.com>
This commit is contained in:
146
vendor/github.com/spf13/cobra/command.go
generated
vendored
146
vendor/github.com/spf13/cobra/command.go
generated
vendored
@@ -63,9 +63,9 @@ type Command struct {
|
||||
// Example is examples of how to use the command.
|
||||
Example string
|
||||
|
||||
// ValidArgs is list of all valid non-flag arguments that are accepted in bash completions
|
||||
// ValidArgs is list of all valid non-flag arguments that are accepted in shell completions
|
||||
ValidArgs []string
|
||||
// ValidArgsFunction is an optional function that provides valid non-flag arguments for bash completion.
|
||||
// ValidArgsFunction is an optional function that provides valid non-flag arguments for shell completion.
|
||||
// It is a dynamic version of using ValidArgs.
|
||||
// Only one of ValidArgs and ValidArgsFunction can be used for a command.
|
||||
ValidArgsFunction func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)
|
||||
@@ -74,19 +74,17 @@ type Command struct {
|
||||
Args PositionalArgs
|
||||
|
||||
// ArgAliases is List of aliases for ValidArgs.
|
||||
// These are not suggested to the user in the bash completion,
|
||||
// These are not suggested to the user in the shell completion,
|
||||
// but accepted if entered manually.
|
||||
ArgAliases []string
|
||||
|
||||
// BashCompletionFunction is custom functions used by the bash autocompletion generator.
|
||||
// BashCompletionFunction is custom bash functions used by the legacy bash autocompletion generator.
|
||||
// For portability with other shells, it is recommended to instead use ValidArgsFunction
|
||||
BashCompletionFunction string
|
||||
|
||||
// Deprecated defines, if this command is deprecated and should print this string when used.
|
||||
Deprecated string
|
||||
|
||||
// Hidden defines, if this command is hidden and should NOT show up in the list of available commands.
|
||||
Hidden bool
|
||||
|
||||
// Annotations are key/value pairs that can be used by applications to identify or
|
||||
// group commands.
|
||||
Annotations map[string]string
|
||||
@@ -126,55 +124,6 @@ type Command struct {
|
||||
// PersistentPostRunE: PersistentPostRun but returns an error.
|
||||
PersistentPostRunE func(cmd *Command, args []string) error
|
||||
|
||||
// SilenceErrors is an option to quiet errors down stream.
|
||||
SilenceErrors bool
|
||||
|
||||
// SilenceUsage is an option to silence usage when an error occurs.
|
||||
SilenceUsage bool
|
||||
|
||||
// DisableFlagParsing disables the flag parsing.
|
||||
// If this is true all flags will be passed to the command as arguments.
|
||||
DisableFlagParsing bool
|
||||
|
||||
// DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...")
|
||||
// will be printed by generating docs for this command.
|
||||
DisableAutoGenTag bool
|
||||
|
||||
// DisableFlagsInUseLine will disable the addition of [flags] to the usage
|
||||
// line of a command when printing help or generating docs
|
||||
DisableFlagsInUseLine bool
|
||||
|
||||
// DisableSuggestions disables the suggestions based on Levenshtein distance
|
||||
// that go along with 'unknown command' messages.
|
||||
DisableSuggestions bool
|
||||
// SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions.
|
||||
// Must be > 0.
|
||||
SuggestionsMinimumDistance int
|
||||
|
||||
// TraverseChildren parses flags on all parents before executing child command.
|
||||
TraverseChildren bool
|
||||
|
||||
// FParseErrWhitelist flag parse errors to be ignored
|
||||
FParseErrWhitelist FParseErrWhitelist
|
||||
|
||||
ctx context.Context
|
||||
|
||||
// commands is the list of commands supported by this program.
|
||||
commands []*Command
|
||||
// parent is a parent command for this command.
|
||||
parent *Command
|
||||
// Max lengths of commands' string lengths for use in padding.
|
||||
commandsMaxUseLen int
|
||||
commandsMaxCommandPathLen int
|
||||
commandsMaxNameLen int
|
||||
// commandsAreSorted defines, if command slice are sorted or not.
|
||||
commandsAreSorted bool
|
||||
// commandCalledAs is the name or alias value used to call this command.
|
||||
commandCalledAs struct {
|
||||
name string
|
||||
called bool
|
||||
}
|
||||
|
||||
// args is actual args parsed from flags.
|
||||
args []string
|
||||
// flagErrorBuf contains all error messages from pflag.
|
||||
@@ -216,6 +165,63 @@ type Command struct {
|
||||
outWriter io.Writer
|
||||
// errWriter is a writer defined by the user that replaces stderr
|
||||
errWriter io.Writer
|
||||
|
||||
//FParseErrWhitelist flag parse errors to be ignored
|
||||
FParseErrWhitelist FParseErrWhitelist
|
||||
|
||||
// CompletionOptions is a set of options to control the handling of shell completion
|
||||
CompletionOptions CompletionOptions
|
||||
|
||||
// commandsAreSorted defines, if command slice are sorted or not.
|
||||
commandsAreSorted bool
|
||||
// commandCalledAs is the name or alias value used to call this command.
|
||||
commandCalledAs struct {
|
||||
name string
|
||||
called bool
|
||||
}
|
||||
|
||||
ctx context.Context
|
||||
|
||||
// commands is the list of commands supported by this program.
|
||||
commands []*Command
|
||||
// parent is a parent command for this command.
|
||||
parent *Command
|
||||
// Max lengths of commands' string lengths for use in padding.
|
||||
commandsMaxUseLen int
|
||||
commandsMaxCommandPathLen int
|
||||
commandsMaxNameLen int
|
||||
|
||||
// TraverseChildren parses flags on all parents before executing child command.
|
||||
TraverseChildren bool
|
||||
|
||||
// Hidden defines, if this command is hidden and should NOT show up in the list of available commands.
|
||||
Hidden bool
|
||||
|
||||
// SilenceErrors is an option to quiet errors down stream.
|
||||
SilenceErrors bool
|
||||
|
||||
// SilenceUsage is an option to silence usage when an error occurs.
|
||||
SilenceUsage bool
|
||||
|
||||
// DisableFlagParsing disables the flag parsing.
|
||||
// If this is true all flags will be passed to the command as arguments.
|
||||
DisableFlagParsing bool
|
||||
|
||||
// DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...")
|
||||
// will be printed by generating docs for this command.
|
||||
DisableAutoGenTag bool
|
||||
|
||||
// DisableFlagsInUseLine will disable the addition of [flags] to the usage
|
||||
// line of a command when printing help or generating docs
|
||||
DisableFlagsInUseLine bool
|
||||
|
||||
// DisableSuggestions disables the suggestions based on Levenshtein distance
|
||||
// that go along with 'unknown command' messages.
|
||||
DisableSuggestions bool
|
||||
|
||||
// SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions.
|
||||
// Must be > 0.
|
||||
SuggestionsMinimumDistance int
|
||||
}
|
||||
|
||||
// Context returns underlying command context. If command wasn't
|
||||
@@ -418,7 +424,7 @@ func (c *Command) UsageString() string {
|
||||
c.outWriter = bb
|
||||
c.errWriter = bb
|
||||
|
||||
c.Usage()
|
||||
CheckErr(c.Usage())
|
||||
|
||||
// Setting things back to normal
|
||||
c.outWriter = tmpOutput
|
||||
@@ -882,7 +888,8 @@ func (c *Command) preRun() {
|
||||
}
|
||||
|
||||
// ExecuteContext is the same as Execute(), but sets the ctx on the command.
|
||||
// Retrieve ctx by calling cmd.Context() inside your *Run lifecycle functions.
|
||||
// Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs
|
||||
// functions.
|
||||
func (c *Command) ExecuteContext(ctx context.Context) error {
|
||||
c.ctx = ctx
|
||||
return c.Execute()
|
||||
@@ -896,6 +903,14 @@ func (c *Command) Execute() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecuteContextC is the same as ExecuteC(), but sets the ctx on the command.
|
||||
// Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs
|
||||
// functions.
|
||||
func (c *Command) ExecuteContextC(ctx context.Context) (*Command, error) {
|
||||
c.ctx = ctx
|
||||
return c.ExecuteC()
|
||||
}
|
||||
|
||||
// ExecuteC executes the command.
|
||||
func (c *Command) ExecuteC() (cmd *Command, err error) {
|
||||
if c.ctx == nil {
|
||||
@@ -912,9 +927,10 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
||||
preExecHookFn(c)
|
||||
}
|
||||
|
||||
// initialize help as the last point possible to allow for user
|
||||
// overriding
|
||||
// initialize help at the last point to allow for user overriding
|
||||
c.InitDefaultHelpCmd()
|
||||
// initialize completion at the last point to allow for user overriding
|
||||
c.initDefaultCompletionCmd()
|
||||
|
||||
args := c.args
|
||||
|
||||
@@ -923,7 +939,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
||||
args = os.Args[1:]
|
||||
}
|
||||
|
||||
// initialize the hidden command to be used for bash completion
|
||||
// initialize the hidden command to be used for shell completion
|
||||
c.initCompleteCmd(args)
|
||||
|
||||
var flags []string
|
||||
@@ -964,13 +980,13 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
// If root command has SilentErrors flagged,
|
||||
// If root command has SilenceErrors flagged,
|
||||
// all subcommands should respect it
|
||||
if !cmd.SilenceErrors && !c.SilenceErrors {
|
||||
c.PrintErrln("Error:", err.Error())
|
||||
}
|
||||
|
||||
// If root command has SilentUsage flagged,
|
||||
// If root command has SilenceUsage flagged,
|
||||
// all subcommands should respect it
|
||||
if !cmd.SilenceUsage && !c.SilenceUsage {
|
||||
c.Println(cmd.UsageString())
|
||||
@@ -1087,10 +1103,10 @@ Simply type ` + c.Name() + ` help [path to command] for full details.`,
|
||||
cmd, _, e := c.Root().Find(args)
|
||||
if cmd == nil || e != nil {
|
||||
c.Printf("Unknown help topic %#q\n", args)
|
||||
c.Root().Usage()
|
||||
CheckErr(c.Root().Usage())
|
||||
} else {
|
||||
cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown
|
||||
cmd.Help()
|
||||
CheckErr(cmd.Help())
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user