Pull out Command interface out into separate file

This commit is contained in:
Mitchell Hashimoto 2013-04-21 18:45:44 -07:00
parent 262d8aa9a8
commit f49c0cb313
2 changed files with 20 additions and 18 deletions

20
packer/command.go Normal file
View File

@ -0,0 +1,20 @@
package packer
// A command is a runnable sub-command of the `packer` application.
// When `packer` is called with the proper subcommand, this will be
// called.
//
// The mapping of command names to command interfaces is in the
// Environment struct.
//
// Run should run the actual command with the given environmet and
// command-line arguments. It should return the exit status when it is
// finished.
//
// Synopsis should return a one-line, short synopsis of the command.
// This should be less than 50 characters ideally.
type Command interface {
Run(env *Environment, args []string) int
Synopsis() string
}

View File

@ -9,24 +9,6 @@ import (
"strings"
)
// A command is a runnable sub-command of the `packer` application.
// When `packer` is called with the proper subcommand, this will be
// called.
//
// The mapping of command names to command interfaces is in the
// Environment struct.
//
// Run should run the actual command with the given environmet and
// command-line arguments. It should return the exit status when it is
// finished.
//
// Synopsis should return a one-line, short synopsis of the command.
// This should be less than 50 characters ideally.
type Command interface {
Run(env *Environment, args []string) int
Synopsis() string
}
// The environment struct contains all the state necessary for a single
// instance of Packer.
//