mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-04-03 00:11:49 +00:00
- Move HyperKit code into a separate file. It should be compilable on all supported OSes now. - Add a (optional) subcommand to "moby run" to select a backend i.e., "moby run hyperkit [options] [prefix]" - On macOS the default is "hyperkit" so that: "moby run [options] [prefix]" just works - Add enough command line parsing to make it easy to add new backends to the run command Update help messages. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"runtime"
|
|
|
|
log "github.com/Sirupsen/logrus"
|
|
)
|
|
|
|
func runUsage() {
|
|
fmt.Printf("USAGE: %s run [backend] [options] [prefix]\n\n", os.Args[0])
|
|
|
|
fmt.Printf("'backend' specifies the run backend.\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(" hyperkit [macOS]\n")
|
|
fmt.Printf("\n")
|
|
fmt.Printf("'options' are the backend specific options.\n")
|
|
fmt.Printf("See 'moby run [backend] --help' for details.\n\n")
|
|
fmt.Printf("'prefix' specifies the path to the VM image.\n")
|
|
fmt.Printf("It defaults to './moby'.\n")
|
|
}
|
|
|
|
func run(args []string) {
|
|
if len(args) < 1 {
|
|
runUsage()
|
|
os.Exit(1)
|
|
}
|
|
|
|
switch args[0] {
|
|
case "help", "-h", "-help", "--help":
|
|
runUsage()
|
|
os.Exit(0)
|
|
case "hyperkit":
|
|
runHyperKit(args[1:])
|
|
default:
|
|
switch runtime.GOOS {
|
|
case "darwin":
|
|
runHyperKit(args)
|
|
default:
|
|
log.Errorf("There currently is no default 'run' backend for your platform.")
|
|
}
|
|
}
|
|
}
|