2013-01-20 00:07:19 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2013-02-14 01:10:00 +00:00
|
|
|
"flag"
|
2013-02-27 01:26:46 +00:00
|
|
|
"github.com/dotcloud/docker/client"
|
2013-01-20 00:07:19 +00:00
|
|
|
"log"
|
|
|
|
"os"
|
2013-02-12 16:48:30 +00:00
|
|
|
"path"
|
2013-01-24 07:14:46 +00:00
|
|
|
)
|
|
|
|
|
2013-01-20 00:07:19 +00:00
|
|
|
func main() {
|
2013-02-12 16:48:30 +00:00
|
|
|
if cmd := path.Base(os.Args[0]); cmd == "docker" {
|
|
|
|
fl_shell := flag.Bool("i", false, "Interactive mode")
|
|
|
|
flag.Parse()
|
|
|
|
if *fl_shell {
|
2013-02-14 01:10:00 +00:00
|
|
|
if err := client.InteractiveMode(flag.Args()...); err != nil {
|
2013-02-12 16:48:30 +00:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
} else {
|
2013-02-14 01:10:00 +00:00
|
|
|
if err := client.SimpleMode(os.Args[1:]); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2013-02-12 16:48:30 +00:00
|
|
|
}
|
|
|
|
} else {
|
2013-02-14 01:10:00 +00:00
|
|
|
if err := client.SimpleMode(append([]string{cmd}, os.Args[1:]...)); err != nil {
|
|
|
|
log.Fatal(err)
|
2013-01-25 19:26:18 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-20 00:07:19 +00:00
|
|
|
}
|