Add basic frame and ctr command line client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
ba46df11b4
commit
847e5bc7ee
8 changed files with 227 additions and 5 deletions
53
ctr/main.go
Normal file
53
ctr/main.go
Normal file
|
@ -0,0 +1,53 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/docker/containerd"
|
||||
)
|
||||
|
||||
const Usage = `High performance conatiner daemon controller`
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "ctr"
|
||||
app.Version = containerd.Version
|
||||
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: "addr",
|
||||
Value: "http://localhost:8888",
|
||||
Usage: "address to the containerd api",
|
||||
},
|
||||
}
|
||||
app.Commands = []cli.Command{
|
||||
ContainersCommand,
|
||||
}
|
||||
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", err)
|
||||
os.Exit(code)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue