mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-25 17:24:00 -04:00
packer, etc: added Help method to Command interface
This will be used for long-form help when "packer help foo" or "packer foo --help" is called.
This commit is contained in:
@@ -10,6 +10,10 @@ import (
|
||||
|
||||
type Command byte
|
||||
|
||||
func (Command) Help() string {
|
||||
return "help"
|
||||
}
|
||||
|
||||
func (Command) Run(env packer.Environment, args []string) int {
|
||||
if len(args) != 1 {
|
||||
env.Ui().Error("A single template argument is required.")
|
||||
|
||||
@@ -22,6 +22,13 @@ func testEnvironment() packer.Environment {
|
||||
return env
|
||||
}
|
||||
|
||||
func TestCommand_Implements(t *testing.T) {
|
||||
assert := asserts.NewTestingAsserts(t, true)
|
||||
|
||||
var actual packer.Command
|
||||
assert.Implementor(new(Command), &actual, "should be a Command")
|
||||
}
|
||||
|
||||
func TestCommand_Run_NoArgs(t *testing.T) {
|
||||
assert := asserts.NewTestingAsserts(t, true)
|
||||
command := new(Command)
|
||||
|
||||
Reference in New Issue
Block a user