github.com/aclaygray/packer@v1.3.2/commands.go (about) 1 package main 2 3 import ( 4 "github.com/hashicorp/packer/command" 5 "github.com/mitchellh/cli" 6 ) 7 8 // Commands is the mapping of all the available Packer commands. 9 var Commands map[string]cli.CommandFactory 10 11 // CommandMeta is the Meta to use for the commands. This must be written 12 // before the CLI is started. 13 var CommandMeta *command.Meta 14 15 const ErrorPrefix = "e:" 16 const OutputPrefix = "o:" 17 18 func init() { 19 Commands = map[string]cli.CommandFactory{ 20 "build": func() (cli.Command, error) { 21 return &command.BuildCommand{ 22 Meta: *CommandMeta, 23 }, nil 24 }, 25 26 "fix": func() (cli.Command, error) { 27 return &command.FixCommand{ 28 Meta: *CommandMeta, 29 }, nil 30 }, 31 32 "inspect": func() (cli.Command, error) { 33 return &command.InspectCommand{ 34 Meta: *CommandMeta, 35 }, nil 36 }, 37 38 "validate": func() (cli.Command, error) { 39 return &command.ValidateCommand{ 40 Meta: *CommandMeta, 41 }, nil 42 }, 43 44 "version": func() (cli.Command, error) { 45 return &command.VersionCommand{ 46 Meta: *CommandMeta, 47 CheckFunc: commandVersionCheck, 48 }, nil 49 }, 50 51 "plugin": func() (cli.Command, error) { 52 return &command.PluginCommand{ 53 Meta: *CommandMeta, 54 }, nil 55 }, 56 } 57 }