github.com/rsyabuta/packer@v1.1.4-0.20180119234903-5ef0c2280f0b/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 "push": func() (cli.Command, error) { 39 return &command.PushCommand{ 40 Meta: *CommandMeta, 41 }, nil 42 }, 43 44 "validate": func() (cli.Command, error) { 45 return &command.ValidateCommand{ 46 Meta: *CommandMeta, 47 }, nil 48 }, 49 50 "version": func() (cli.Command, error) { 51 return &command.VersionCommand{ 52 Meta: *CommandMeta, 53 CheckFunc: commandVersionCheck, 54 }, nil 55 }, 56 57 "plugin": func() (cli.Command, error) { 58 return &command.PluginCommand{ 59 Meta: *CommandMeta, 60 }, nil 61 }, 62 } 63 }