Skip to content

Commit 9c75f29

Browse files
committed
Move namespace code to subpackage
Signed-off-by: apostasie <[email protected]>
1 parent d1bc54d commit 9c75f29

File tree

7 files changed

+35
-7
lines changed

7 files changed

+35
-7
lines changed

cmd/nerdctl/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434

3535
"github.com/containerd/nerdctl/v2/cmd/nerdctl/completion"
3636
"github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
37+
"github.com/containerd/nerdctl/v2/cmd/nerdctl/namespace"
3738
"github.com/containerd/nerdctl/v2/cmd/nerdctl/network"
3839
"github.com/containerd/nerdctl/v2/cmd/nerdctl/volume"
3940
"github.com/containerd/nerdctl/v2/pkg/config"
@@ -296,7 +297,7 @@ Config file ($NERDCTL_TOML): %s
296297
network.NewNetworkCommand(),
297298
volume.NewVolumeCommand(),
298299
newSystemCommand(),
299-
newNamespaceCommand(),
300+
namespace.NewNamespaceCommand(),
300301
newBuilderCommand(),
301302
// #endregion
302303

cmd/nerdctl/namespace.go renamed to cmd/nerdctl/namespace/namespace.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package namespace
1818

1919
import (
2020
"fmt"
@@ -33,7 +33,7 @@ import (
3333
"github.com/containerd/nerdctl/v2/pkg/mountutil/volumestore"
3434
)
3535

36-
func newNamespaceCommand() *cobra.Command {
36+
func NewNamespaceCommand() *cobra.Command {
3737
namespaceCommand := &cobra.Command{
3838
Annotations: map[string]string{helpers.Category: helpers.Management},
3939
Use: "namespace",

cmd/nerdctl/namespace_create.go renamed to cmd/nerdctl/namespace/namespace_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package namespace
1818

1919
import (
2020
"github.com/spf13/cobra"

cmd/nerdctl/namespace_inspect.go renamed to cmd/nerdctl/namespace/namespace_inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package namespace
1818

1919
import (
2020
"github.com/spf13/cobra"

cmd/nerdctl/namespace_remove.go renamed to cmd/nerdctl/namespace/namespace_remove.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package namespace
1818

1919
import (
2020
"github.com/spf13/cobra"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 namespace
18+
19+
import (
20+
"testing"
21+
22+
"github.com/containerd/nerdctl/v2/pkg/testutil"
23+
)
24+
25+
func TestMain(m *testing.M) {
26+
testutil.M(m)
27+
}

cmd/nerdctl/namespace_update.go renamed to cmd/nerdctl/namespace/namespace_update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package namespace
1818

1919
import (
2020
"github.com/spf13/cobra"

0 commit comments

Comments
 (0)