2016-11-30 00:52:04 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2017-01-19 05:57:01 +00:00
|
|
|
"github.com/Sirupsen/logrus"
|
2017-01-19 06:14:37 +00:00
|
|
|
"github.com/docker/containerd"
|
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-12-14 17:15:27 +00:00
|
|
|
eventsCommand,
|
2017-01-12 18:15:27 +00:00
|
|
|
deleteCommand,
|
2017-01-13 06:08:09 +00:00
|
|
|
listCommand,
|
|
|
|
inspectCommand,
|
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)
|
|
|
|
}
|
|
|
|
}
|