linuxkit: Order push/run backends and cases alphabetically

This makes it easier to identify where a new backend should be added.
It's also simpler to match help text and case statements.

Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
Dave Tucker 2017-06-05 16:27:23 +01:00
parent 3dcd8a2730
commit 719f260e01
2 changed files with 23 additions and 20 deletions

View File

@ -11,13 +11,13 @@ import (
func pushUsage() { func pushUsage() {
invoked := filepath.Base(os.Args[0]) invoked := filepath.Base(os.Args[0])
fmt.Printf("USAGE: %s push [backend] [options] [prefix]\n\n", invoked) fmt.Printf("USAGE: %s push [backend] [options] [prefix]\n\n", invoked)
fmt.Printf("'backend' specifies the push backend.\n") fmt.Printf("'backend' specifies the push backend.\n")
fmt.Printf("Supported backends are\n") fmt.Printf("Supported backends are\n")
// Please keep these in alphabetical order
fmt.Printf(" aws\n")
fmt.Printf(" azure\n")
fmt.Printf(" gcp\n") fmt.Printf(" gcp\n")
fmt.Printf(" vcenter\n") fmt.Printf(" vcenter\n")
fmt.Printf(" azure\n")
fmt.Printf(" aws\n")
fmt.Printf("\n") fmt.Printf("\n")
fmt.Printf("'options' are the backend specific options.\n") fmt.Printf("'options' are the backend specific options.\n")
fmt.Printf("See '%s push [backend] --help' for details.\n\n", invoked) fmt.Printf("See '%s push [backend] --help' for details.\n\n", invoked)
@ -31,17 +31,18 @@ func push(args []string) {
} }
switch args[0] { switch args[0] {
// Please keep cases in alphabetical order
case "aws":
pushAWS(args[1:])
case "azure":
pushAzure(args[1:])
case "gcp":
pushGcp(args[1:])
case "help", "-h", "-help", "--help": case "help", "-h", "-help", "--help":
pushUsage() pushUsage()
os.Exit(0) os.Exit(0)
case "gcp":
pushGcp(args[1:])
case "vcenter": case "vcenter":
pushVCenter(args[1:]) pushVCenter(args[1:])
case "azure":
pushAzure(args[1:])
case "aws":
pushAWS(args[1:])
default: default:
log.Errorf("No 'push' backend specified.") log.Errorf("No 'push' backend specified.")
} }

View File

@ -16,14 +16,15 @@ func runUsage() {
fmt.Printf("'backend' specifies the run backend.\n") fmt.Printf("'backend' specifies the run backend.\n")
fmt.Printf("If not specified the platform specific default will be used\n") fmt.Printf("If not specified the platform specific default will be used\n")
fmt.Printf("Supported backends are (default platform in brackets):\n") fmt.Printf("Supported backends are (default platform in brackets):\n")
// Please keep these in alphabetical order
fmt.Printf(" aws\n") fmt.Printf(" aws\n")
fmt.Printf(" azure\n") fmt.Printf(" azure\n")
fmt.Printf(" gcp\n") fmt.Printf(" gcp\n")
fmt.Printf(" hyperkit [macOS]\n") fmt.Printf(" hyperkit [macOS]\n")
fmt.Printf(" packet\n")
fmt.Printf(" qemu [linux]\n") fmt.Printf(" qemu [linux]\n")
fmt.Printf(" vcenter\n") fmt.Printf(" vcenter\n")
fmt.Printf(" vmware\n") fmt.Printf(" vmware\n")
fmt.Printf(" packet\n")
fmt.Printf("\n") fmt.Printf("\n")
fmt.Printf("'options' are the backend specific options.\n") fmt.Printf("'options' are the backend specific options.\n")
fmt.Printf("See '%s run [backend] --help' for details.\n\n", invoked) fmt.Printf("See '%s run [backend] --help' for details.\n\n", invoked)
@ -38,23 +39,24 @@ func run(args []string) {
} }
switch args[0] { switch args[0] {
// Please keep cases in alphabetical order
case "aws":
runAWS(args[1:])
case "azure":
runAzure(args[1:])
case "gcp":
runGcp(args[1:])
case "help", "-h", "-help", "--help": case "help", "-h", "-help", "--help":
runUsage() runUsage()
os.Exit(0) os.Exit(0)
case "aws":
runAWS(args[1:])
case "hyperkit": case "hyperkit":
runHyperKit(args[1:]) runHyperKit(args[1:])
case "azure":
runAzure(args[1:])
case "vmware":
runVMware(args[1:])
case "gcp":
runGcp(args[1:])
case "qemu":
runQemu(args[1:])
case "packet": case "packet":
runPacket(args[1:]) runPacket(args[1:])
case "qemu":
runQemu(args[1:])
case "vmware":
runVMware(args[1:])
case "vcenter": case "vcenter":
runVcenter(args[1:]) runVcenter(args[1:])
default: default: