App returns a *cli.App instance.
()
| 82 | |
| 83 | // App returns a *cli.App instance. |
| 84 | func App() *cli.App { |
| 85 | app := cli.NewApp() |
| 86 | app.Name = "containerd" |
| 87 | app.Version = version.Version |
| 88 | app.Usage = usage |
| 89 | app.Description = ` |
| 90 | containerd is a high performance container runtime whose daemon can be started |
| 91 | by using this command. If none of the *config*, *publish*, *oci-hook*, or *help* commands |
| 92 | are specified, the default action of the **containerd** command is to start the |
| 93 | containerd daemon in the foreground. |
| 94 | |
| 95 | |
| 96 | A default configuration is used if no TOML configuration is specified or located |
| 97 | at the default file location. The *containerd config* command can be used to |
| 98 | generate the default configuration for containerd. The output of that command |
| 99 | can be used and modified as necessary as a custom configuration.` |
| 100 | app.Flags = []cli.Flag{ |
| 101 | &cli.StringFlag{ |
| 102 | Name: "config", |
| 103 | Aliases: []string{"c"}, |
| 104 | Usage: "Path to the configuration file", |
| 105 | Value: filepath.Join(defaults.DefaultConfigDir, "config.toml"), |
| 106 | }, |
| 107 | &cli.StringFlag{ |
| 108 | Name: "log-level", |
| 109 | Aliases: []string{"l"}, |
| 110 | Usage: "Set the logging level [trace, debug, info, warn, error, fatal, panic]", |
| 111 | }, |
| 112 | &cli.StringFlag{ |
| 113 | Name: "address", |
| 114 | Aliases: []string{"a"}, |
| 115 | Usage: "Address for containerd's GRPC server", |
| 116 | }, |
| 117 | &cli.StringFlag{ |
| 118 | Name: "root", |
| 119 | Usage: "containerd root directory", |
| 120 | }, |
| 121 | &cli.StringFlag{ |
| 122 | Name: "state", |
| 123 | Usage: "containerd state directory", |
| 124 | }, |
| 125 | } |
| 126 | app.Flags = append(app.Flags, serviceFlags()...) |
| 127 | app.Commands = []*cli.Command{ |
| 128 | configCommand, |
| 129 | publishCommand, |
| 130 | ociHook, |
| 131 | } |
| 132 | app.Action = func(cliContext *cli.Context) error { |
| 133 | if args := cliContext.Args(); args.First() != "" { |
| 134 | return cli.ShowCommandHelp(cliContext, args.First()) |
| 135 | } |
| 136 | |
| 137 | var ( |
| 138 | start = time.Now() |
| 139 | signals = make(chan os.Signal, 2048) |
| 140 | serverC = make(chan *server.Server, 1) |
| 141 | ctx, cancel = context.WithCancel(cliContext.Context) |
no test coverage detected