Debian Codegraph @

cmd/soci/main.go

raw symbols SCIP
1 /*
2 Copyright The Soci Snapshotter Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 /*
18 Copyright The containerd Authors.
19
20 Licensed under the Apache License, Version 2.0 (the "License");
21 you may not use this file except in compliance with the License.
22 You may obtain a copy of the License at
23
24 http://www.apache.org/licenses/LICENSE-2.0
25
26 Unless required by applicable law or agreed to in writing, software
27 distributed under the License is distributed on an "AS IS" BASIS,
28 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 See the License for the specific language governing permissions and
30 limitations under the License.
31 */
32
33 package main
34
35 import (
36 "fmt"
37 "os"
38
39 "github.com/awslabs/soci-snapshotter/cmd/soci/commands"
40 "github.com/awslabs/soci-snapshotter/cmd/soci/commands/image"
41 "github.com/awslabs/soci-snapshotter/cmd/soci/commands/index"
42 "github.com/awslabs/soci-snapshotter/cmd/soci/commands/ztoc"
43 "github.com/awslabs/soci-snapshotter/config"
44 "github.com/awslabs/soci-snapshotter/version"
45 "github.com/containerd/containerd/cmd/ctr/commands/run"
46 "github.com/containerd/containerd/defaults"
47 "github.com/containerd/containerd/namespaces"
48
49 //nolint:staticcheck
50 "github.com/containerd/containerd/pkg/seed"
51 "github.com/urfave/cli"
52 )
53
54 func init() {
55 //nolint:staticcheck
56 seed.WithTimeAndRand() //lint:ignore SA1019, WithTimeAndRand is deprecated and we should remove it.
57 }
58
59 func main() {
60 app := cli.NewApp()
61 app.Name = "soci"
62 app.Flags = []cli.Flag{
63 cli.StringFlag{
64 Name: "address, a",
65 Usage: "address for containerd's GRPC server",
66 Value: defaults.DefaultAddress,
67 EnvVar: "CONTAINERD_ADDRESS",
68 },
69 cli.StringFlag{
70 Name: "namespace, n",
71 Usage: "namespace to use with commands",
72 Value: namespaces.Default,
73 EnvVar: namespaces.NamespaceEnvVar,
74 },
75 cli.DurationFlag{
76 Name: "timeout",
77 Usage: "timeout for commands",
78 },
79 cli.BoolFlag{
80 Name: "debug",
81 Usage: "enable debug output",
82 },
83 cli.StringFlag{
84 Name: "content-store",
85 Usage: "use a specific content store (soci or containerd)",
86 Value: config.DefaultContentStoreType,
87 },
88 }
89
90 app.Version = fmt.Sprintf("%s %s", version.Version, version.Revision)
91
92 app.Commands = []cli.Command{
93 image.Command,
94 index.Command,
95 ztoc.Command,
96 commands.CreateCommand,
97 commands.PushCommand,
98 run.Command,
99 commands.RebuildDBCommand,
100 }
101
102 if err := app.Run(os.Args); err != nil {
103 fmt.Fprintf(os.Stderr, "soci: %v\n", err)
104 os.Exit(1)
105 }
106 }