package main import ( "fmt" "os" "github.com/Sirupsen/logrus" "github.com/docker/containerd" "github.com/urfave/cli" ) func main() { app := cli.NewApp() app.Name = "dist" app.Version = containerd.Version app.Usage = ` ___ __ ____/ (_)____/ /_ / __ / / ___/ __/ / /_/ / (__ ) /_ \__,_/_/____/\__/ distribution tool ` app.Flags = []cli.Flag{ cli.BoolFlag{ Name: "debug", Usage: "enable debug output in logs", }, } app.Commands = []cli.Command{ fetchCommand, } 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, "dist: %s\n", err) os.Exit(1) } }