containerd/ctr/main.go
Peter Edge d2e319523d Use protoversion for containerd version
Signed-off-by: Peter Edge <peter.edge@gmail.com>
2015-12-18 13:06:04 +00:00

56 lines
1 KiB
Go

package main
import (
"fmt"
"os"
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/docker/containerd"
)
const Usage = `High performance container daemon cli`
func main() {
app := cli.NewApp()
app.Name = "ctr"
app.Version = containerd.Version.VersionString()
app.Usage = Usage
app.Authors = []cli.Author{
{
Name: "@crosbymichael",
Email: "crosbymichael@gmail.com",
},
}
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "debug",
Usage: "enable debug output in the logs",
},
cli.StringFlag{
Name: "address",
Value: "/run/containerd/containerd.sock",
Usage: "address of GRPC API",
},
}
app.Commands = []cli.Command{
CheckpointCommand,
ContainersCommand,
EventsCommand,
VersionCommand,
}
app.Before = func(context *cli.Context) error {
if context.GlobalBool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
return nil
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}
func fatal(err string, code int) {
fmt.Fprintf(os.Stderr, "[ctr] %s\n", err)
os.Exit(code)
}