Add ServerById() function and acceptance test.
diff --git a/acceptance/02-list-servers.go b/acceptance/02-list-servers.go
index bd1da3c..acfc802 100644
--- a/acceptance/02-list-servers.go
+++ b/acceptance/02-list-servers.go
@@ -4,8 +4,11 @@
"fmt"
"github.com/rackspace/gophercloud"
"os"
+ "flag"
)
+var quiet = flag.Bool("quiet", false, "Quiet mode, for acceptance testing. $? still indicates errors though.")
+
func main() {
provider := os.Getenv("SDK_PROVIDER")
username := os.Getenv("SDK_USERNAME")
@@ -19,6 +22,8 @@
os.Exit(1)
}
+ flag.Parse()
+
acc, err := gophercloud.Authenticate(
provider,
gophercloud.AuthOptions{
@@ -45,9 +50,9 @@
panic(err)
}
- fmt.Println("Server ID")
- fmt.Println("----------------------------------------")
- for _, s := range servers {
- fmt.Printf(" %s\n", s.Id)
+ if !*quiet {
+ for _, s := range servers {
+ fmt.Printf("%s\n", s.Id)
+ }
}
}