2016-11-30 00:52:04 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/docker/containerd"
|
2016-12-12 22:26:51 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2016-11-30 00:52:04 +00:00
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := cli.NewApp()
|
|
|
|
app.Name = "ctr"
|
|
|
|
app.Version = containerd.Version
|
|
|
|
app.Usage = `
|
2016-12-09 17:17:34 +00:00
|
|
|
__
|
2016-11-30 00:52:04 +00:00
|
|
|
_____/ /______
|
|
|
|
/ ___/ __/ ___/
|
2016-12-09 17:17:34 +00:00
|
|
|
/ /__/ /_/ /
|
|
|
|
\___/\__/_/
|
|
|
|
|
2016-11-30 00:52:04 +00:00
|
|
|
containerd client
|
|
|
|
`
|
|
|
|
app.Flags = []cli.Flag{
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "debug",
|
|
|
|
Usage: "enable debug output in logs",
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "socket, s",
|
|
|
|
Usage: "socket path for containerd's GRPC server",
|
|
|
|
Value: "/run/containerd/containerd.sock",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
app.Commands = []cli.Command{
|
|
|
|
runCommand,
|
2016-12-09 17:17:34 +00:00
|
|
|
execCommand,
|
2016-11-30 00:52:04 +00:00
|
|
|
}
|
|
|
|
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 {
|
|
|
|
fmt.Fprintf(os.Stderr, "containerd: %s\n", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|