main: fix the help output to show up

This commit is contained in:
Mitchell Hashimoto 2014-06-26 10:24:32 -07:00
parent 8cd4814beb
commit 92e1e09a69
2 changed files with 11 additions and 6 deletions

View File

@ -38,11 +38,11 @@ func resource_aws_instance_create(
// properly. // properly.
rs := s.MergeDiff(d) rs := s.MergeDiff(d)
// Create the instance
runOpts := &ec2.RunInstances{ runOpts := &ec2.RunInstances{
ImageId: rs.Attributes["ami"], ImageId: rs.Attributes["ami"],
InstanceType: rs.Attributes["instance_type"], InstanceType: rs.Attributes["instance_type"],
} }
log.Printf("[DEBUG] Run configuration: %#v", runOpts) log.Printf("[DEBUG] Run configuration: %#v", runOpts)
runResp, err := ec2conn.RunInstances(runOpts) runResp, err := ec2conn.RunInstances(runOpts)
if err != nil { if err != nil {
@ -52,8 +52,7 @@ func resource_aws_instance_create(
instance := &runResp.Instances[0] instance := &runResp.Instances[0]
log.Printf("[INFO] Instance ID: %s", instance.InstanceId) log.Printf("[INFO] Instance ID: %s", instance.InstanceId)
// Store the resource state now so that we can return it in the case // Store the resulting ID so we can look this up later
// of any errors.
rs.ID = instance.InstanceId rs.ID = instance.InstanceId
// Wait for the instance to become running so we can get some attributes // Wait for the instance to become running so we can get some attributes

12
main.go
View File

@ -100,9 +100,10 @@ func wrappedMain() int {
} }
cli := &cli.CLI{ cli := &cli.CLI{
Args: args, Args: args,
Commands: Commands, Commands: Commands,
HelpFunc: cli.BasicHelpFunc("terraform"), HelpFunc: cli.BasicHelpFunc("terraform"),
HelpWriter: os.Stdout,
} }
exitCode, err := cli.Run() exitCode, err := cli.Run()
@ -131,7 +132,12 @@ func copyOutput(r io.Reader) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
defaultR, err := pr.Prefix("")
if err != nil {
panic(err)
}
go io.Copy(os.Stderr, stderrR) go io.Copy(os.Stderr, stderrR)
go io.Copy(os.Stdout, stdoutR) go io.Copy(os.Stdout, stdoutR)
go io.Copy(os.Stdout, defaultR)
} }