File tree Expand file tree Collapse file tree 13 files changed +55
-20
lines changed Expand file tree Collapse file tree 13 files changed +55
-20
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ package main
18
18
19
19
import (
20
20
"github.com/spf13/cobra"
21
+
22
+ "github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
21
23
)
22
24
23
25
func newApparmorCommand () * cobra.Command {
24
26
cmd := & cobra.Command {
25
- Annotations : map [string ]string {Category : Management },
27
+ Annotations : map [string ]string {helpers . Category : helpers . Management },
26
28
Use : "apparmor" ,
27
29
Short : "Manage AppArmor profiles" ,
28
30
RunE : unknownSubcommandAction ,
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ import (
32
32
33
33
func newBuilderCommand () * cobra.Command {
34
34
var builderCommand = & cobra.Command {
35
- Annotations : map [string ]string {Category : Management },
35
+ Annotations : map [string ]string {helpers . Category : helpers . Management },
36
36
Use : "builder" ,
37
37
Short : "Manage builds" ,
38
38
RunE : unknownSubcommandAction ,
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ package main
18
18
19
19
import (
20
20
"github.com/spf13/cobra"
21
+
22
+ "github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
21
23
)
22
24
23
25
func newContainerCommand () * cobra.Command {
24
26
containerCommand := & cobra.Command {
25
- Annotations : map [string ]string {Category : Management },
27
+ Annotations : map [string ]string {helpers . Category : helpers . Management },
26
28
Use : "container" ,
27
29
Short : "Manage containers" ,
28
30
RunE : unknownSubcommandAction ,
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright The containerd 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
+ package helpers
18
+
19
+ const (
20
+ Category = "category"
21
+ Management = "management"
22
+ )
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ package main
18
18
19
19
import (
20
20
"github.com/spf13/cobra"
21
+
22
+ "github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
21
23
)
22
24
23
25
func newImageCommand () * cobra.Command {
24
26
cmd := & cobra.Command {
25
- Annotations : map [string ]string {Category : Management },
27
+ Annotations : map [string ]string {helpers . Category : helpers . Management },
26
28
Use : "image" ,
27
29
Short : "Manage images" ,
28
30
RunE : unknownSubcommandAction ,
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ package main
18
18
19
19
import (
20
20
"github.com/spf13/cobra"
21
+
22
+ "github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
21
23
)
22
24
23
25
func newIPFSCommand () * cobra.Command {
24
26
cmd := & cobra.Command {
25
- Annotations : map [string ]string {Category : Management },
27
+ Annotations : map [string ]string {helpers . Category : helpers . Management },
26
28
Use : "ipfs" ,
27
29
Short : "Distributing images on IPFS" ,
28
30
RunE : unknownSubcommandAction ,
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ package main
18
18
19
19
import (
20
20
"github.com/spf13/cobra"
21
+
22
+ "github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
21
23
)
22
24
23
25
func newIPFSRegistryCommand () * cobra.Command {
24
26
cmd := & cobra.Command {
25
- Annotations : map [string ]string {Category : Management },
27
+ Annotations : map [string ]string {helpers . Category : helpers . Management },
26
28
Use : "registry" ,
27
29
Short : "Manage read-only registry backed by IPFS" ,
28
30
PreRunE : checkExperimental ("ipfs" ),
Original file line number Diff line number Diff line change @@ -42,11 +42,6 @@ import (
42
42
"github.com/containerd/nerdctl/v2/pkg/version"
43
43
)
44
44
45
- const (
46
- Category = "category"
47
- Management = "management"
48
- )
49
-
50
45
var (
51
46
// To print Bold Text
52
47
Bold = color .New (color .Bold ).SprintfFunc ()
@@ -75,7 +70,7 @@ func usage(c *cobra.Command) error {
75
70
if f .Hidden {
76
71
continue
77
72
}
78
- if f .Annotations [Category ] == Management {
73
+ if f .Annotations [helpers . Category ] == helpers . Management {
79
74
managementCommands = append (managementCommands , f )
80
75
} else {
81
76
nonManagementCommands = append (nonManagementCommands , f )
@@ -103,7 +98,7 @@ func usage(c *cobra.Command) error {
103
98
t += "\n "
104
99
return t
105
100
}
106
- s += printCommands ("Management commands" , managementCommands )
101
+ s += printCommands ("helpers. Management commands" , managementCommands )
107
102
s += printCommands ("Commands" , nonManagementCommands )
108
103
109
104
s += Bold ("Flags" ) + ":\n "
@@ -293,7 +288,7 @@ Config file ($NERDCTL_TOML): %s
293
288
newTopCommand (),
294
289
newStatsCommand (),
295
290
296
- // #region Management
291
+ // #region helpers. Management
297
292
newContainerCommand (),
298
293
newImageCommand (),
299
294
newNetworkCommand (),
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ import (
35
35
36
36
func newNamespaceCommand () * cobra.Command {
37
37
namespaceCommand := & cobra.Command {
38
- Annotations : map [string ]string {Category : Management },
38
+ Annotations : map [string ]string {helpers . Category : helpers . Management },
39
39
Use : "namespace" ,
40
40
Aliases : []string {"ns" },
41
41
Short : "Manage containerd namespaces" ,
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ package main
18
18
19
19
import (
20
20
"github.com/spf13/cobra"
21
+
22
+ "github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
21
23
)
22
24
23
25
func newNetworkCommand () * cobra.Command {
24
26
networkCommand := & cobra.Command {
25
- Annotations : map [string ]string {Category : Management },
27
+ Annotations : map [string ]string {helpers . Category : helpers . Management },
26
28
Use : "network" ,
27
29
Short : "Manage networks" ,
28
30
RunE : unknownSubcommandAction ,
You can’t perform that action at this time.
0 commit comments