|
|
|
|
@ -181,7 +181,7 @@ func wrappedMain() int {
|
|
|
|
|
cli := &cli.CLI{
|
|
|
|
|
Args: args,
|
|
|
|
|
Commands: Commands,
|
|
|
|
|
HelpFunc: cli.BasicHelpFunc("packer"),
|
|
|
|
|
HelpFunc: excludeHelpFunc(Commands, []string{"plugin"}),
|
|
|
|
|
HelpWriter: os.Stdout,
|
|
|
|
|
Version: Version,
|
|
|
|
|
}
|
|
|
|
|
@ -195,6 +195,27 @@ func wrappedMain() int {
|
|
|
|
|
return exitCode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// excludeHelpFunc filters commands we don't want to show from the list of
|
|
|
|
|
// commands displayed in packer's help text.
|
|
|
|
|
func excludeHelpFunc(commands map[string]cli.CommandFactory, exclude []string) cli.HelpFunc {
|
|
|
|
|
// Make search slice into a map so we can use use the `if found` idiom
|
|
|
|
|
// instead of a nested loop.
|
|
|
|
|
var excludes = make(map[string]interface{}, len(exclude))
|
|
|
|
|
for _, item := range exclude {
|
|
|
|
|
excludes[item] = nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create filtered list of commands
|
|
|
|
|
helpCommands := []string{}
|
|
|
|
|
for command := range commands {
|
|
|
|
|
if _, found := excludes[command]; !found {
|
|
|
|
|
helpCommands = append(helpCommands, command)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cli.FilteredHelpFunc(helpCommands, cli.BasicHelpFunc("packer"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// extractMachineReadable checks the args for the machine readable
|
|
|
|
|
// flag and returns whether or not it is on. It modifies the args
|
|
|
|
|
// to remove this flag.
|
|
|
|
|
|